C# Class LinFu.IoC.ServiceContainer

Represents a service container with additional extension points for customizing service instances
Inheritance: IServiceContainer
Afficher le fichier Open project: philiplaureano/LinFu Class Usage Examples

Private Properties

Свойство Type Description

Méthodes publiques

Méthode Description
AddFactory ( Type serviceType, IEnumerable additionalParameterTypes, IFactory factory ) : void

Adds an IFactory instance and associates it with the given service type.

AddFactory ( string serviceName, Type serviceType, IEnumerable additionalParameterTypes, IFactory factory ) : void

Adds an IFactory instance and associates it with the given service type and service name.

Contains ( Type serviceType, IEnumerable additionalParameterTypes ) : bool

Determines whether or not the given serviceType can be instantiated by the container.

Contains ( string serviceName, Type serviceType, IEnumerable additionalParameterTypes ) : bool

Determines whether or not a service can be created using the given service name and service type.

GetService ( Type serviceType ) : object

Overridden. Causes the container to instantiate the service with the given service type. If the service type cannot be created, then an exception will be thrown if the IContainer.SuppressErrors property is set to false. Otherwise, it will simply return null.

This overload of the GetService method has been overridden so that its results can be handled by the postprocessors.

GetService ( string serviceName, Type serviceType ) : object

Causes the container to instantiate the service with the given service type. If the service type cannot be created, then an exception will be thrown if the IContainer.SuppressErrors property is set to false. Otherwise, it will simply return null.

ServiceContainer ( ) : System

Initializes the container with the default services.

ServiceContainer ( IGetService getServiceBehavior, IFactoryStorage factoryStorage ) : System

Initializes the container with a custom ICreateInstance type.

Method Details

AddFactory() public méthode

Adds an IFactory instance and associates it with the given service type.
public AddFactory ( Type serviceType, IEnumerable additionalParameterTypes, IFactory factory ) : void
serviceType System.Type The service type to associate with the factory
additionalParameterTypes IEnumerable The list of additional parameters that this factory type will support.
factory IFactory The instance that will be responsible for creating the service instance
Résultat void

AddFactory() public méthode

Adds an IFactory instance and associates it with the given service type and service name.
public AddFactory ( string serviceName, Type serviceType, IEnumerable additionalParameterTypes, IFactory factory ) : void
serviceName string The name of the service to associate with the given instance.
serviceType System.Type The type of service that the factory will be able to create.
additionalParameterTypes IEnumerable The list of additional parameters that this factory type will support.
factory IFactory The instance that will create the object instance.
Résultat void

Contains() public méthode

Determines whether or not the given serviceType can be instantiated by the container.
public Contains ( Type serviceType, IEnumerable additionalParameterTypes ) : bool
serviceType System.Type The type of service to instantiate.
additionalParameterTypes IEnumerable The list of additional parameters that this factory type will support.
Résultat bool

Contains() public méthode

Determines whether or not a service can be created using the given service name and service type.
public Contains ( string serviceName, Type serviceType, IEnumerable additionalParameterTypes ) : bool
serviceName string The name of the service to associate with the given instance.
serviceType System.Type The type of service that the factory will be able to create.
additionalParameterTypes IEnumerable The list of additional parameters that this factory type will support.
Résultat bool

GetService() public méthode

Overridden. Causes the container to instantiate the service with the given service type. If the service type cannot be created, then an exception will be thrown if the IContainer.SuppressErrors property is set to false. Otherwise, it will simply return null.
This overload of the GetService method has been overridden so that its results can be handled by the postprocessors.
public GetService ( Type serviceType ) : object
serviceType System.Type The service type to instantiate.
Résultat object

GetService() public méthode

Causes the container to instantiate the service with the given service type. If the service type cannot be created, then an exception will be thrown if the IContainer.SuppressErrors property is set to false. Otherwise, it will simply return null.
public GetService ( string serviceName, Type serviceType ) : object
serviceName string The name of the service to instantiate.
serviceType System.Type The service type to instantiate.
Résultat object

ServiceContainer() public méthode

Initializes the container with the default services.
public ServiceContainer ( ) : System
Résultat System

ServiceContainer() public méthode

Initializes the container with a custom ICreateInstance type.
public ServiceContainer ( IGetService getServiceBehavior, IFactoryStorage factoryStorage ) : System
getServiceBehavior IGetService The instance that will be responsible for generating service instances.
factoryStorage IFactoryStorage The instance responsible for determining which factory instance will instantiate a given service request.
Résultat System