-
Notifications
You must be signed in to change notification settings - Fork 10
Generics
Peter Csajtai edited this page Feb 16, 2017
·
21 revisions
Stashbox supports the registration of open generic types, and concrete generic service creation from them with generic parameter constraint checking:
interface IDrow<TLeftHand, TRightHand>
{
//...
}
class Drow<TLeftHand, TRightHand> : IDrow<TLeftHand, TRightHand>
{
public Drow(TLeftHand leftHand, TRightHand rightHand)
{
//...
}
}
container.RegisterType(typeof(IDrow<,>), typeof(Drow<,>));
container.RegisterType<Twinkle>();
container.RegisterType<Icingdeath>();
//resolution
var drizzt = container.Resolve<IDrow<Twinkle, Icingdeath>>();
- 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