Skip to content

Releases: iQuarc/AppBoot

Add support for registrations by convention

10 Mar 13:43
Compare
Choose a tag to compare

iQuarc.AppBoot 1.1.0.nupkg available on nuget.org

Registrations into the Dependency Injection Container may also be done by conventions, through the new ConventionRegistrationBehavior.

var conventions = new ConventionRegistrationBehavior();

conventions.ForTypesDerivedFrom<Repository>().ExportInterfaces(x => x.Name.EndsWith("Repository"));
conventions.ForType<InterceptorsResolver>().Export(b => b.AsContractType<IInterceptorsResolver>().WithLifetime(Lifetime.Application));
conventions.ForType<UnitOfWork>().Export(b => b.AsContractType<IUnitOfWork>());

Bootstrapper b = new Bootstrapper(assemblies);
b.AddRegistrationBehavior(conventions);
...