I am registering a type like thus:
IUnityContainer container = new UnityContainer()
.RegisterType<IActiveDirectoryUser, ADUser>();
The class ADUser contains 2 constructors, one parameterless, and one with a single parameter. When the resolver goes to resolve it, it chooses the the one with parameters. How do I tell it to use the parameterless contrustor?
When registering the type, use
InjectionConstructorto instruct Unity that it should use parameterless constructor:Since you are passing no types to
InjectionConstructorconstructor, Unity will know to use parameterless constructor when instantiatingADUserclass.