Unity uses reflection to determine the types of constructor parameters. With your constructor, he found the FairFlexxDbContext and bool options. It tries to build an instance of each type and does not work on bool, because it is a value type. It does not recognize the default value that you provided in order to get through this error.
For this to work, you have a couple of options. Either tell us to register your IAddressImportRepository
with InjectionConstructor
and tell him how to enable your constructor options or move your bool parameter to a property instead. Since bool is an optional parameter, I would recommend moving it as a property.
container.RegisterType<IAddressImportRepository, AddressImportRepository>( new PerRequestLifetimeManager(), new InjectionConstructor(new ResolvedParameter<FairFlexxDbContext>(), true));
or
public AddressImportRepository(FairFlexxDbContext context) : base(context, true) { IsUseSecurePredicate = true; } public bool IsUseSecurePredicate { get; set; }
source share