C# Class MvcApi.ServicesContainer

Inheritance: IDependencyResolver, IDisposable
ファイルを表示 Open project: dax70/MvcApi

Public Methods

Method 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.

Protected Methods

Method 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

Method Description
Dispose ( ) : void
GetServiceInstances ( Type serviceType ) : List

Method Details

Add() public method

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.
return void

AddRange() public method

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.
return void

Clear() public method

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.
return void

ClearMultiple() protected method

protected ClearMultiple ( Type serviceType ) : void
serviceType System.Type
return void

ClearSingle() protected abstract method

protected abstract ClearSingle ( Type serviceType ) : void
serviceType System.Type
return void

FindIndex() public method

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.
return int

GetService() public abstract method

public abstract GetService ( Type serviceType ) : object
serviceType System.Type
return object

GetServices() public abstract method

public abstract GetServices ( Type serviceType ) : IEnumerable
serviceType System.Type
return IEnumerable

Insert() public method

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.
return void

InsertRange() public method

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.
return void

IsSingleService() public abstract method

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
return bool

Remove() public method

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.
return bool

RemoveAll() public method

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.
return int

RemoveAt() public method

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.
return void

Replace() public method

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.
return void

ReplaceMultiple() protected method

protected ReplaceMultiple ( Type serviceType, object service ) : void
serviceType System.Type
service object
return void

ReplaceRange() public method

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.
return void

ReplaceSingle() protected abstract method

protected abstract ReplaceSingle ( Type serviceType, object service ) : void
serviceType System.Type
service object
return void

ResetCache() protected method

protected ResetCache ( Type serviceType ) : void
serviceType System.Type
return void