I have registered my classes like this:
private static IUnityContainer BuildUnityContainer()
container.RegisterType< IService<Product>, ProductService >("Product");
Normally I use constructor injection but I have one case where I would like to create an instance of a class for use inside a method. In that method I need to do something like the following:
= new container.Resolve<IService<Product>>();
I need to create a service class for a service of type IService<Product> if the serviceClassName passed in is "Product".
I need to create a service class for a service of type IService<Package> if the serviceClassName passed in is "Package"
I keep reading how I should be using Constructor Injection but for this case I am not sure how I can use it. All I need is a temporary copy of the service instance just for the lifetime of when my method executes.
Can someone help me out and tell me how I can do this. In the above I have two problems. Firstly I don't know how to pass the container to the child and second I want to get a IService< passedParameter > based on the parameter passed to
Hope I can get some good advice.