When trying to refactor an existing asp.net-mvc application to use Turbine as an IoC I get the following result:
MvcTurbine.ComponentModel.ServiceResolutionException Could not resolve serviceType 'CommonProject.Web.Shared.Controllers.SearchController' Source Object: at MvcTurbine.Unity.UnityServiceLocator.Resolve[T](Type type)
The (only) ctor for my SearchController looks like this
public SearchController(ISearchService searchService):base(new SearchViewData())
{
开发者_JS百科 this.searchService = searchService;
}
And my registration looks like this
public class SearchServiceRegistration: IServiceRegistration
{
public void Register(IServiceLocator locator)
{
locator.Register<ISearchService>(typeof(LuceneSearchService));
}
}
UPDATE
I found it (it was a bit stupid)
locator.Register<ISearchService>(typeof(LuceneSearchService));
should have been
locator.Register<ISearchService,LuceneSearchService>();
Don't know what the first syntax is supposed to do though.
Do you miss a registration for the SearchController?
精彩评论