Compartir a través de


ServiceProvider.AddService Method (Type, ServiceCreatorCallback, Boolean)

Adds the specified service to the internal collection of services or to the parent service container.

Namespace:  Microsoft.VisualStudio.Data.Framework
Assembly:  Microsoft.VisualStudio.Data.Framework (in Microsoft.VisualStudio.Data.Framework.dll)

Syntax

'Declaración
Public Overridable Sub AddService ( _
    serviceType As Type, _
    callback As ServiceCreatorCallback, _
    promote As Boolean _
)
public virtual void AddService(
    Type serviceType,
    ServiceCreatorCallback callback,
    bool promote
)
public:
virtual void AddService(
    Type^ serviceType, 
    ServiceCreatorCallback^ callback, 
    bool promote
)
abstract AddService : 
        serviceType:Type * 
        callback:ServiceCreatorCallback * 
        promote:bool -> unit 
override AddService : 
        serviceType:Type * 
        callback:ServiceCreatorCallback * 
        promote:bool -> unit 
public function AddService(
    serviceType : Type, 
    callback : ServiceCreatorCallback, 
    promote : boolean
)

Parameters

  • serviceType
    Type: System.Type
    The type of the service to add.
  • promote
    Type: System.Boolean
    A Boolean value indicating whether to add the service to the parent container.

Implements

IServiceContainer.AddService(Type, ServiceCreatorCallback, Boolean)

Remarks

The callback parameter allows a service to be declared as available but delays the creation of the object until the service is requested.

.NET Framework Security

See Also

Reference

ServiceProvider Class

AddService Overload

Microsoft.VisualStudio.Data.Framework Namespace