im trying to get ms unity to inject an object into a constructor and am having problems due to the class having multiple constructors and the same number of parameters. I know you can annotate the constructor but i dont want to do that. How can i get unity to use the correct constructor
my constructors are like so :-
public JobsHandler(ICentralRepositoryContainer context)
public JobsHandler(ICentralRepositoryLifeTimehelper centralRepositoryLifeTimehelper)
and i was using some code i found :-
uContainer.RegisterType<ICentralRepositoryContainer, Entities>().Configure<InjectedMembers>().
ConfigureInjectionFor<JobsHandler>(new InjectionConstructor());
but in getting a
The type CentralRepository.BusinessLogic.JobsHandler does not have a
constructor that takes the parameters ()
Im guess this is because i havent specified the parameters in the injectionconstructor object. Am i doing this correctly?
I think you will want to resolve the ICentralRepositoryContainer and use it in the InjectionConstructor
Or register the jobs handler while specifying the constructor.
See this link for a more complete example of the above:
http://msdn.microsoft.com/en-us/library/ff650036.aspx