I'm trying to add a WebAPI to an existing ASP.Net MVC project and my question is regarding Unity:
Before with UnityMVC alone, the project had in the App_Start folder, the class UnityConfig with the following code:
container.RegisterType<IUnitOfWork, UnitOfWork>(new PerRequestLifetimeManager());
container.RegisterType<IDataContext, tfe_schemaContext>(new PerRequestLifetimeManager());
container.RegisterType<IPrintJobService, PrintJobService>(new PerRequestLifetimeManager());
container.RegisterType<IRepository<print_job>, Repository<print_job>>(new PerRequestLifetimeManager());
To use a WebAPI, I added UnityWebAPI via NuGet and this action added UnityMvcActivator class in the App_Start folder.
The following error displayed when I execute the project: "The type Unity.WebApi.UnityDependencyResolver does not appear to implement Microsoft.Practices.ServiceLocation.IServiceLocator. Parameter name: commonServiceLocator".
I found different examples of code using a Bootstrapper class but without using the UnityConfig class or UnityMvcActivator.
In the Bootrstrapper class, the registration of the types is like this:
container.RegisterType<IProductServices, ProductServices>().RegisterType<UnitOfWork>(new HierarchicalLifetimeManager());
I'm a little bit lost with all this, please help me understand and fix this error.