C# Class Hiro.GenericInstanceContainer

Represents a container type that instantiates generic types at runtime.
Inheritance: IMicroContainer
Show file Open project: philiplaureano/Hiro Class Usage Examples

Public Methods

Method Description
Contains ( Type serviceType, string key ) : bool

Determines whether or not the container can instantiate the given serviceType.

GenericInstanceContainer ( string serviceName, Type genericServiceType, Type genericTypeImplementation, IDependencyContainer dependencyContainer ) : System

Initializes a new instance of the GenericInstanceContainer class.

GetAllInstances ( Type serviceType ) : IEnumerable

Returns all generic instances that match the given serviceType.

GetInstance ( Type serviceType, string key ) : object

Attempts to get an instance of the given serviceType.

Protected Methods

Method Description
Register ( Type serviceType, Type concreteType, DependencyMap map ) : void

Registers the generic service type.

Private Methods

Method Description
BuildBaseContainer ( ) : void

Method Details

Contains() public method

Determines whether or not the container can instantiate the given serviceType.
public Contains ( Type serviceType, string key ) : bool
serviceType System.Type The service type.
key string The name of the service
return bool

GenericInstanceContainer() public method

Initializes a new instance of the GenericInstanceContainer class.
public GenericInstanceContainer ( string serviceName, Type genericServiceType, Type genericTypeImplementation, IDependencyContainer dependencyContainer ) : System
serviceName string The name of the generic service.
genericServiceType System.Type The generic type that represents the service type.
genericTypeImplementation System.Type The type that represents the generic service type implementation.
dependencyContainer IDependencyContainer The dependency map that describes the list of services that will be available to the instantiated generic types.
return System

GetAllInstances() public method

Returns all generic instances that match the given serviceType.
public GetAllInstances ( Type serviceType ) : IEnumerable
serviceType System.Type The service type.
return IEnumerable

GetInstance() public method

Attempts to get an instance of the given serviceType.
public GetInstance ( Type serviceType, string key ) : object
serviceType System.Type The service type.
key string The service name.
return object

Register() protected method

Registers the generic service type.
protected Register ( Type serviceType, Type concreteType, DependencyMap map ) : void
serviceType System.Type The service type that will be registered.
concreteType System.Type The generic concrete type that will implement the generic service type.
map DependencyMap The dependency map that contains all the dependencies.
return void