C# Class MvcApi.ServicesContainer

Inheritance: IDependencyResolver, IDisposable
Afficher le fichier Open project: dax70/MvcApi

Méthodes publiques

Méthode Description
Add ( Type serviceType, object service ) : void

Adds a service to the end of services list for the given service type.

AddRange ( Type serviceType, IEnumerable services ) : void

Adds the services of the specified collection to the end of the services list for the given service type.

Clear ( Type serviceType ) : void

Removes all the service instances of the given service type.

FindIndex ( Type serviceType, Predicate match ) : int

Searches for a service that matches the conditions defined by the specified predicate, and returns the zero-based index of the first occurrence.

GetService ( Type serviceType ) : object
GetServices ( Type serviceType ) : IEnumerable
Insert ( Type serviceType, int index, object service ) : void

Inserts a service into the collection at the specified index.

InsertRange ( Type serviceType, int index, IEnumerable services ) : void

Inserts the elements of the collection into the service list at the specified index.

IsSingleService ( Type serviceType ) : bool

Determine whether the service type should be fetched with GetService or GetServices.

Remove ( Type serviceType, object service ) : bool

Removes the first occurrence of the given service from the service list for the given service type.

RemoveAll ( Type serviceType, Predicate match ) : int

Removes all the elements that match the conditions defined by the specified predicate.

RemoveAt ( Type serviceType, int index ) : void

Removes the service at the specified index.

Replace ( Type serviceType, object service ) : void

Replaces all existing services for the given service type with the given service instance. This works for both singular and plural services.

ReplaceRange ( Type serviceType, IEnumerable services ) : void

Replaces all existing services for the given service type with the given service instances.

Méthodes protégées

Méthode Description
ClearMultiple ( Type serviceType ) : void
ClearSingle ( Type serviceType ) : void
ReplaceMultiple ( Type serviceType, object service ) : void
ReplaceSingle ( Type serviceType, object service ) : void
ResetCache ( Type serviceType ) : void

Private Methods

Méthode Description
Dispose ( ) : void
GetServiceInstances ( Type serviceType ) : List

Method Details

Add() public méthode

Adds a service to the end of services list for the given service type.
public Add ( Type serviceType, object service ) : void
serviceType System.Type The service type.
service object The service instance.
Résultat void

AddRange() public méthode

Adds the services of the specified collection to the end of the services list for the given service type.
public AddRange ( Type serviceType, IEnumerable services ) : void
serviceType System.Type The service type.
services IEnumerable The services to add.
Résultat void

Clear() public méthode

Removes all the service instances of the given service type.
public Clear ( Type serviceType ) : void
serviceType System.Type The service type to clear from the services list.
Résultat void

ClearMultiple() protected méthode

protected ClearMultiple ( Type serviceType ) : void
serviceType System.Type
Résultat void

ClearSingle() protected abstract méthode

protected abstract ClearSingle ( Type serviceType ) : void
serviceType System.Type
Résultat void

FindIndex() public méthode

Searches for a service that matches the conditions defined by the specified predicate, and returns the zero-based index of the first occurrence.
public FindIndex ( Type serviceType, Predicate match ) : int
serviceType System.Type The service type.
match Predicate The delegate that defines the conditions of the element /// to search for.
Résultat int

GetService() public abstract méthode

public abstract GetService ( Type serviceType ) : object
serviceType System.Type
Résultat object

GetServices() public abstract méthode

public abstract GetServices ( Type serviceType ) : IEnumerable
serviceType System.Type
Résultat IEnumerable

Insert() public méthode

Inserts a service into the collection at the specified index.
public Insert ( Type serviceType, int index, object service ) : void
serviceType System.Type The service type.
index int The zero-based index at which the service should be inserted. /// If is passed, ensures the element is added to the end.
service object The service to insert.
Résultat void

InsertRange() public méthode

Inserts the elements of the collection into the service list at the specified index.
public InsertRange ( Type serviceType, int index, IEnumerable services ) : void
serviceType System.Type The service type.
index int The zero-based index at which the new elements should be inserted. /// If is passed, ensures the elements are added to the end.
services IEnumerable The collection of services to insert.
Résultat void

IsSingleService() public abstract méthode

Determine whether the service type should be fetched with GetService or GetServices.
public abstract IsSingleService ( Type serviceType ) : bool
serviceType System.Type type of service to query
Résultat bool

Remove() public méthode

Removes the first occurrence of the given service from the service list for the given service type.
public Remove ( Type serviceType, object service ) : bool
serviceType System.Type The service type.
service object The service instance to remove.
Résultat bool

RemoveAll() public méthode

Removes all the elements that match the conditions defined by the specified predicate.
public RemoveAll ( Type serviceType, Predicate match ) : int
serviceType System.Type The service type.
match Predicate The delegate that defines the conditions of the elements to remove.
Résultat int

RemoveAt() public méthode

Removes the service at the specified index.
public RemoveAt ( Type serviceType, int index ) : void
serviceType System.Type The service type.
index int The zero-based index of the service to remove.
Résultat void

Replace() public méthode

Replaces all existing services for the given service type with the given service instance. This works for both singular and plural services.
public Replace ( Type serviceType, object service ) : void
serviceType System.Type The service type.
service object The service instance.
Résultat void

ReplaceMultiple() protected méthode

protected ReplaceMultiple ( Type serviceType, object service ) : void
serviceType System.Type
service object
Résultat void

ReplaceRange() public méthode

Replaces all existing services for the given service type with the given service instances.
public ReplaceRange ( Type serviceType, IEnumerable services ) : void
serviceType System.Type The service type.
services IEnumerable The service instances.
Résultat void

ReplaceSingle() protected abstract méthode

protected abstract ReplaceSingle ( Type serviceType, object service ) : void
serviceType System.Type
service object
Résultat void

ResetCache() protected méthode

protected ResetCache ( Type serviceType ) : void
serviceType System.Type
Résultat void