I try to register a class which constructor requires a few string, a ILog and a bool. All in my container is registered as a singleton (set as the default Reuse).
But whenever I try to get an instance of that class container.Resolve<AzmanAccess>()
, an exception gets thrown.
Unable to resolve Boolean as parameter "accessAll" in Company.Common.Util.Authentication.AzmanAccess: Company.Common.Util.Authentication.IAzmanAccess {RequiredServiceType=Company.Common.Util.Authentication.AzmanAccess} as parameter "azmanAccess" in Company.Common.Util.Authentication.AzmanCustomAccess: Company.Common.Util.Authentication.IAccess as parameter "access" in Company.Common.Util.Authentication.User: Company.Common.Util.Authentication.IUser Where CurrentScope: null and ResolutionScope: null and Found registrations: skipAuthz,{ID=53, ImplType=Boolean, Reuse=SingletonReuse {Lifespan=1000}}} System.Object,{ID=25, ImplType=Boolean, Reuse=SingletonReuse {Lifespan=1000}}}
I register my class like this:
container.RegisterInstance(_accessAll, serviceKey: AccessAll);
container.RegisterInstance(_activeDirectoryDomain, serviceKey: ActiveDirectoryDomain);
container.RegisterInstance(_azmanConnString, serviceKey: AzmanConnString);
container.RegisterInstance(_azmanStore, serviceKey: AzmanStore);
container.Register(Made.Of(() => new AzmanAccess(
Arg.Of<bool>(AccessAll),
Arg.Of<ILog>(),
Arg.Of<string>(ActiveDirectoryDomain),
Arg.Of<string>(AzmanConnString),
Arg.Of<string>(AzmanStore)
)));
and the constructor is:
public AzmanAccess(bool accessAll, ILog logger, string activeDirectoryDomain, string azmanConnString, string azmanStore)
Where servicekeys (AccessAll, ...) are unique (tried with objects, then string).
What's going wrong?