asp.net mvc - Parameterized controller constructor never gets hit -
With my pet project, I am trying to use the turbine as a di container.
I am entering unity as a locatorprovider such as:
static MvcApplication () {ServiceLocatorManager.SetLocatorProvider ((=) New Unity Ascivoljak ( )); }
My user is a non-parameter manufacturer in the repository and I am registering it like this:
public class UserRepositoryRegistration: IServiceRegistration {Public Zero Register ( IServiceLocator Locator) {Locator.Register & lt; IUserRepository, UserRepository & gt; (); }}
Then I have my Home Controller that should accept the IUserRepository
Public class HomeController: Controller {Private Readonly IUserRepository userRepository; Public Home Controller (IUserRepository repository) {userRepository = Repository; }}
If I leave the parasail cellar (as above is in the code snippet) I get this ():
server error '/' application The parameter-creator is not defined for this object. Description: An uncontrolled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where the code originated from it. Exception Description: System.MissingMethodException: A constructor with no parameters defined for an object is not defined. [Invalid Operation Exception: An error occurred while trying to create a controller type 'Boris.BeekProject.Guis.Web.Controllers.HomeController'. Ensure that the controller has a parasailable public constructor.]
Then my home controller is bound to keep a parasite stitcher. It seems that this is not a Unity Controller factory, which is immediate, but the default one
UPDATE
My MVC application is the successor of turbine applying and since the RootyResestation is properly Raised, I think the problem is elsewhere.
Update
As suggested by Thomas Eyed, I wanted to override the TurbineApplification. Autocomponent
method, but checking the object browser I was, I can not find any reference to this method. Apart from this, when I look at the Nurddner example, this method is not either override. After checking, I failed to find any sane person and provided the placeholder page after the link of the document. Is someone doing me wrong but can fill me up?
Am I missing something? Your build of the turbine does not support MVC2, in which an additional parameter for the creation of controllers is done.
If you want to use MVC2 beta (.net4) for your development, then I suggest you get a new one
Hope you can help!
Comments
Post a Comment