-
Notifications
You must be signed in to change notification settings - Fork 10
Container configuration
Peter Csajtai edited this page Mar 14, 2017
·
30 revisions
When you are creating a new instance of Stashbox you can use an action delegate to customize it's configuration e.g.:
var container = new Stashbox(config => config
.WithCircularDependencyTracking()
.WithCircularDependencyWithLazy()
.WithEnumerableOrderRule(Rules.EnumerableOrder.PreserveOrder)
//etc...);
The reconfiguration of the container also supported by calling the container.Configure(...)
method.
- WithDisposableTransientTracking() - Enables the tracking of disposable transient objects.
- WithParentContainerResolution() - Enables the resolution through the parent container.
- WithCircularDependencyTracking() - Enables the circular dependency tracking.
-
WithCircularDependencyWithLazy() - Allows circular dependencies through
Lazy<>
objects. - WithOptionalAndDefaultValueInjection() - Enables the optional and default value injection.
- WithUnknownTypeResolution() - Enables the unknown type resolution.
- WithMemberInjectionWithoutAnnotation(...) - Enables the member injection without annotation.
- PropertiesWithPublicSetter - With this flag the container will perform auto injection on properties which has a public setter.
- PropertiesWithLimitedAccess - With this flag the container will perform auto injection on properties which has a non public setter as well.
- PrivateFields - With this flag the container will perform auto injection on private fields too.
- WithConstructorSelectionRule(...) - Sets the constructor selection rule.
- PreferMostParameters - Prefers the constructor which has the longest parameter list.
- PreferLessParameters - Prefers the constructor which has the shortest parameter list.
- ByPass - Doesn't change the constructor order, it'll use the first usable constructor.
- WithDependencySelectionRule(...) - Sets the dependency selection rule.
- PreferLastRegistered - Prefers the last registered service.
- PreferFirstRegistered - Prefers the first registered service.
- ByPass - Doesn't change the dependency order, it'll use the first usable dependency.
- WithEnumerableOrderRule(...) - Sets the enumerable ordering rule.
- PreserveOrder - Preserves the registration order of the resolved services.
- ByPass - Doesn't change the resolution order of the services.
- 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