-
Notifications
You must be signed in to change notification settings - Fork 10
Assembly registration
Peter Csajtai edited this page Jul 10, 2020
·
4 revisions
You can register services defined within a given assembly:
container.RegisterAssembly(assembly);
In this case, all services defined in the given assembly will be registered by their implemented interfaces, base types, and themselves.
You can also register an assembly by using just a type defined in it:
container.RegisterAssemblyContaining<Drizzt>();
You can pass an assembly collection also:
container.RegisterAssemblies(new[] { assembly1, assembly2 });
You can specify which services you want to register from an assembly with a filter predicate:
container.RegisterAssembly(assembly, type => type == typeof(Drizzt));
//or
container.RegisterAssemblyContaining<Drizzt>(type => type == typeof(Drizzt));
//or
container.RegisterAssemblies(new[] { assembly1, assembly2 }, type => type == typeof(Drizzt));
You can use the configurator parameter to configure the service registrations:
container.RegisterAssembly(assembly, configurator: context => context.WithScopedLifetime());
- Service registration
- Factory registration
- Assembly registration
- Composition
- Fluent registration api
- Service resolution
- Resolution by attributes
- Conventional resolution
- Delegate resolution
- Conditional resolution
- Multi resolution
- Lifetimes
- Generics
- Generic wrappers
- Decorators
- Resolvers
- Scopes
- Container configuration
- Container diagnostics
- Exceptions