C# Класс MvcApi.ServicesContainer

Наследование: IDependencyResolver, IDisposable
Показать файл Открыть проект

Открытые методы

Метод Описание
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.

Защищенные методы

Метод Описание
ClearMultiple ( Type serviceType ) : void
ClearSingle ( Type serviceType ) : void
ReplaceMultiple ( Type serviceType, object service ) : void
ReplaceSingle ( Type serviceType, object service ) : void
ResetCache ( Type serviceType ) : void

Приватные методы

Метод Описание
Dispose ( ) : void
GetServiceInstances ( Type serviceType ) : List

Описание методов

Add() публичный Метод

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.
Результат void

AddRange() публичный Метод

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.
Результат void

Clear() публичный Метод

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.
Результат void

ClearMultiple() защищенный Метод

protected ClearMultiple ( Type serviceType ) : void
serviceType System.Type
Результат void

ClearSingle() защищенный абстрактный Метод

protected abstract ClearSingle ( Type serviceType ) : void
serviceType System.Type
Результат void

FindIndex() публичный Метод

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.
Результат int

GetService() публичный абстрактный Метод

public abstract GetService ( Type serviceType ) : object
serviceType System.Type
Результат object

GetServices() публичный абстрактный Метод

public abstract GetServices ( Type serviceType ) : IEnumerable
serviceType System.Type
Результат IEnumerable

Insert() публичный Метод

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.
Результат void

InsertRange() публичный Метод

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.
Результат void

IsSingleService() публичный абстрактный Метод

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
Результат bool

Remove() публичный Метод

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.
Результат bool

RemoveAll() публичный Метод

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.
Результат int

RemoveAt() публичный Метод

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.
Результат void

Replace() публичный Метод

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.
Результат void

ReplaceMultiple() защищенный Метод

protected ReplaceMultiple ( Type serviceType, object service ) : void
serviceType System.Type
service object
Результат void

ReplaceRange() публичный Метод

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.
Результат void

ReplaceSingle() защищенный абстрактный Метод

protected abstract ReplaceSingle ( Type serviceType, object service ) : void
serviceType System.Type
service object
Результат void

ResetCache() защищенный Метод

protected ResetCache ( Type serviceType ) : void
serviceType System.Type
Результат void