C# Class Castle.MicroKernel.Registration.ServiceDescriptor

显示文件 Open project: castleproject/Windsor Class Usage Examples

Public Methods

Method Description
AllInterfaces ( ) : Castle.MicroKernel.Registration.BasedOnDescriptor

Uses all interfaces implemented by the type (or its base types) as well as their base interfaces.

Base ( ) : Castle.MicroKernel.Registration.BasedOnDescriptor

Uses the base type matched on.

DefaultInterfaces ( ) : Castle.MicroKernel.Registration.BasedOnDescriptor

Uses all interfaces that have names matched by implementation type name. Matches Foo to IFoo, SuperFooExtended to IFoo and IFooExtended etc

FirstInterface ( ) : Castle.MicroKernel.Registration.BasedOnDescriptor

Uses the first interface of a type. This method has non-deterministic behavior when type implements more than one interface!

FromInterface ( ) : Castle.MicroKernel.Registration.BasedOnDescriptor

Uses base type to lookup the sub interface.

FromInterface ( Type implements ) : Castle.MicroKernel.Registration.BasedOnDescriptor

Uses implements to lookup the sub interface. For example: if you have IService and IProductService : ISomeInterface, IService, ISomeOtherInterface. When you call FromInterface(typeof(IService)) then IProductService will be used. Useful when you want to register _all_ your services and but not want to specify all of them.

Select ( IEnumerable types ) : Castle.MicroKernel.Registration.BasedOnDescriptor

Assigns the supplied service types.

Select ( ServiceSelector selector ) : Castle.MicroKernel.Registration.BasedOnDescriptor

Assigns a custom service selection strategy.

Self ( ) : Castle.MicroKernel.Registration.BasedOnDescriptor

Uses the type itself.

Private Methods

Method Description
AddFromInterface ( Type type, Type implements, ICollection matches ) : void
GetInterfaceName ( Type @interface ) : string
GetServices ( Type type, Type baseType ) : ICollection
GetTopLevelInterfaces ( Type type ) : IEnumerable
ServiceDescriptor ( Castle.MicroKernel.Registration.BasedOnDescriptor basedOnDescriptor ) : System
WorkaroundCLRBug ( Type serviceType ) : Type

This is a workaround for a CLR bug in which GetInterfaces() returns interfaces with no implementations.

Method Details

AllInterfaces() public method

Uses all interfaces implemented by the type (or its base types) as well as their base interfaces.
public AllInterfaces ( ) : Castle.MicroKernel.Registration.BasedOnDescriptor
return Castle.MicroKernel.Registration.BasedOnDescriptor

Base() public method

Uses the base type matched on.
public Base ( ) : Castle.MicroKernel.Registration.BasedOnDescriptor
return Castle.MicroKernel.Registration.BasedOnDescriptor

DefaultInterfaces() public method

Uses all interfaces that have names matched by implementation type name. Matches Foo to IFoo, SuperFooExtended to IFoo and IFooExtended etc
public DefaultInterfaces ( ) : Castle.MicroKernel.Registration.BasedOnDescriptor
return Castle.MicroKernel.Registration.BasedOnDescriptor

FirstInterface() public method

Uses the first interface of a type. This method has non-deterministic behavior when type implements more than one interface!
public FirstInterface ( ) : Castle.MicroKernel.Registration.BasedOnDescriptor
return Castle.MicroKernel.Registration.BasedOnDescriptor

FromInterface() public method

Uses base type to lookup the sub interface.
public FromInterface ( ) : Castle.MicroKernel.Registration.BasedOnDescriptor
return Castle.MicroKernel.Registration.BasedOnDescriptor

FromInterface() public method

Uses implements to lookup the sub interface. For example: if you have IService and IProductService : ISomeInterface, IService, ISomeOtherInterface. When you call FromInterface(typeof(IService)) then IProductService will be used. Useful when you want to register _all_ your services and but not want to specify all of them.
public FromInterface ( Type implements ) : Castle.MicroKernel.Registration.BasedOnDescriptor
implements System.Type
return Castle.MicroKernel.Registration.BasedOnDescriptor

Select() public method

Assigns the supplied service types.
public Select ( IEnumerable types ) : Castle.MicroKernel.Registration.BasedOnDescriptor
types IEnumerable
return Castle.MicroKernel.Registration.BasedOnDescriptor

Select() public method

Assigns a custom service selection strategy.
public Select ( ServiceSelector selector ) : Castle.MicroKernel.Registration.BasedOnDescriptor
selector ServiceSelector
return Castle.MicroKernel.Registration.BasedOnDescriptor

Self() public method

Uses the type itself.
public Self ( ) : Castle.MicroKernel.Registration.BasedOnDescriptor
return Castle.MicroKernel.Registration.BasedOnDescriptor