views:

32

answers:

1

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())
{
    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.

A: 

Do you miss a registration for the SearchController?

HackerBaloo
As far as I understand the DI concept, the controller shouldn't need a registration. I found the solution though. I'll put it in OP
borisCallens