C# Class Guidelines.Ioc.StructureMap.Adaptors.StructureMapAdaptor

Adapter used for ServiceLocator for StructureMap. Set by using ServiceLocator.SetLocatorProvider.
Inheritance: ServiceLocatorImplBase
显示文件 Open project: basicdays/Guidelines

Public Methods

Method Description
StructureMapAdaptor ( IContainer container ) : System

Creates a new adaptor with the supplied container.

Protected Methods

Method Description
DoGetAllInstances ( Type serviceType ) : IEnumerable

Returns all instances of serviceType. If none are found, an empty enumeration is returned.

DoGetInstance ( Type serviceType, string key ) : object

Returns an instance of serviceType, and uses key if it is not null. If serviceType is a class, it will construct that class and perform dependency injection regardless if it is registered in the container.

Method Details

DoGetAllInstances() protected method

Returns all instances of serviceType. If none are found, an empty enumeration is returned.
If there was an error constructing the enumeration.
protected DoGetAllInstances ( Type serviceType ) : IEnumerable
serviceType System.Type The type to check for anything registered on this type.
return IEnumerable

DoGetInstance() protected method

Returns an instance of serviceType, and uses key if it is not null. If serviceType is a class, it will construct that class and perform dependency injection regardless if it is registered in the container.
If there was an error constructing the type, or if there was nothing registered for an interface.
protected DoGetInstance ( Type serviceType, string key ) : object
serviceType System.Type The type to construct.
key string A key to use in the container. Will not be used if null or empty.
return object

StructureMapAdaptor() public method

Creates a new adaptor with the supplied container.
public StructureMapAdaptor ( IContainer container ) : System
container IContainer A container to use for the service locator.
return System