Partager via


DefaultServices Class

Represents a container for service instances used by the HttpConfiguration. Note that this container only supports known types, and methods to get or set arbitrary service types will throw ArgumentException when called. For creation of arbitrary types, please use IDependencyResolver instead. The supported types for this container are: IActionValueBinderIApiExplorerIAssembliesResolverIBodyModelValidatorIContentNegotiatorIDocumentationProviderIFilterProviderIHostBufferPolicySelectorIHttpActionInvokerIHttpActionSelectorIHttpControllerActivatorIHttpControllerSelectorIHttpControllerTypeResolverITraceManagerITraceWriterIStructuredQueryBuilderModelBinderProviderModelMetadataProviderModelValidatorProviderValueProviderFactoryPassing any type which is not on this to any method on this interface will cause an ArgumentException to be thrown.

Inheritance Hierarchy

System.Object
  System.Web.Http.Controllers.ServicesContainer
    System.Web.Http.Services.DefaultServices

Namespace:  System.Web.Http.Services
Assembly:  System.Web.Http (in System.Web.Http.dll)

Syntax

'Declaration
Public Class DefaultServices _
    Inherits ServicesContainer
'Usage
Dim instance As DefaultServices
public class DefaultServices : ServicesContainer
public ref class DefaultServices : public ServicesContainer
type DefaultServices =  
    class 
        inherit ServicesContainer 
    end
public class DefaultServices extends ServicesContainer

The DefaultServices type exposes the following members.

Constructors

  Name Description
Protected method DefaultServices() Initializes a new instance of the DefaultServices class.
Public method DefaultServices(HttpConfiguration) Initializes a new instance of the DefaultServices class with a specified HttpConfiguration object.

Top

Methods

  Name Description
Public method Add Adds a service to the end of services list for the given service type. (Inherited from ServicesContainer.)
Public method AddRange Adds the services of the specified collection to the end of the services list for the given service type. (Inherited from ServicesContainer.)
Public method Clear Removes all the service instances of the given service type. (Inherited from ServicesContainer.)
Protected method ClearMultiple Removes all instances of a multi-instance service type. (Inherited from ServicesContainer.)
Protected method ClearSingle Removes a single-instance service from the default services. (Overrides ServicesContainer.ClearSingle(Type).)
Public method Dispose Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Overrides ServicesContainer.Dispose().)
Public method Equals (Inherited from Object.)
Protected method Finalize (Inherited from Object.)
Public method FindIndex Searches for a service that matches the conditions defined by the specified predicate, and returns the zero-based index of the first occurrence. (Inherited from ServicesContainer.)
Public method GetHashCode (Inherited from Object.)
Public method GetService Gets a service of the specified type. (Overrides ServicesContainer.GetService(Type).)
Protected method GetServiceInstances Gets the list of service objects for a given service type, and validates the service type. (Overrides ServicesContainer.GetServiceInstances(Type).)
Public method GetServices Gets the list of service objects for a given service type. (Overrides ServicesContainer.GetServices(Type).)
Public method GetType (Inherited from Object.)
Public method Insert Inserts a service into the collection at the specified index. (Inherited from ServicesContainer.)
Public method InsertRange Inserts the elements of the collection into the service list at the specified index. (Inherited from ServicesContainer.)
Public method IsSingleService Queries whether a service type is single-instance. (Overrides ServicesContainer.IsSingleService(Type).)
Protected method MemberwiseClone (Inherited from Object.)
Public method Remove Removes the first occurrence of the given service from the service list for the given service type. (Inherited from ServicesContainer.)
Public method RemoveAll Removes all the elements that match the conditions defined by the specified predicate. (Inherited from ServicesContainer.)
Public method RemoveAt Removes the service at the specified index. (Inherited from ServicesContainer.)
Public method Replace Replaces all existing services for the given service type with the given service instance. This works for both singular and plural services. (Inherited from ServicesContainer.)
Protected method ReplaceMultiple Replaces all instances of a multi-instance service with a new instance. (Inherited from ServicesContainer.)
Public method ReplaceRange Replaces all existing services for the given service type with the given service instances. (Inherited from ServicesContainer.)
Protected method ReplaceSingle Replaces a single-instance service object. (Overrides ServicesContainer.ReplaceSingle(Type, Object).)
Protected method ResetCache Removes the cached values for a single service type. (Overrides ServicesContainer.ResetCache(Type).)
Public method ToString (Inherited from Object.)

Top

Extension Methods

  Name Description
Public Extension Method GetActionInvoker Gets the IHttpActionInvoker service. (Defined by ServicesExtensions.)
Public Extension Method GetActionSelector Gets the IHttpActionSelector service. (Defined by ServicesExtensions.)
Public Extension Method GetActionValueBinder Gets the IActionValueBinder service. (Defined by ServicesExtensions.)
Public Extension Method GetApiExplorer Gets the IApiExplorer service. (Defined by ServicesExtensions.)
Public Extension Method GetAssembliesResolver Gets the IAssembliesResolver service. (Defined by ServicesExtensions.)
Public Extension Method GetBodyModelValidator Gets the IBodyModelValidator service. (Defined by ServicesExtensions.)
Public Extension Method GetContentNegotiator Gets the IContentNegotiator service. (Defined by ServicesExtensions.)
Public Extension Method GetDocumentationProvider Gets the IDocumentationProvider service. (Defined by ServicesExtensions.)
Public Extension Method GetFilterProviders Gets the IFilterProvider collection. (Defined by ServicesExtensions.)
Public Extension Method GetHostBufferPolicySelector Gets the IHostBufferPolicySelector service. (Defined by ServicesExtensions.)
Public Extension Method GetHttpControllerActivator Gets the IHttpControllerActivator service. (Defined by ServicesExtensions.)
Public Extension Method GetHttpControllerSelector Gets the IHttpControllerSelector service. (Defined by ServicesExtensions.)
Public Extension Method GetHttpControllerTypeResolver Gets the IHttpControllerTypeResolver service. (Defined by ServicesExtensions.)
Public Extension Method GetModelBinderProviders Gets the ModelBinderProvider collection. (Defined by ServicesExtensions.)
Public Extension Method GetModelMetadataProvider Gets the ModelMetadataProvider service. (Defined by ServicesExtensions.)
Public Extension Method GetModelValidatorProviders Gets the ModelValidatorProvider collection. (Defined by ServicesExtensions.)
Public Extension Method GetTraceManager Gets the ITraceManager service. (Defined by ServicesExtensions.)
Public Extension Method GetTraceWriter Gets the ITraceWriterservice. (Defined by ServicesExtensions.)
Public Extension Method GetValueProviderFactories Gets the ValueProviderFactory collection. (Defined by ServicesExtensions.)

Top

Remarks

No content here will be updated; please do not add material here.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

System.Web.Http.Services Namespace