Share via


ServiceProvider Class

Provides an object that can proffer services by using both the managed and unmanaged IServiceProvider interfaces.

Inheritance Hierarchy

System.Object
  Microsoft.VisualStudio.Data.Framework.ServiceProvider
    Microsoft.VisualStudio.Data.Framework.DataSiteableServiceProvider<T>

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

Syntax

'Declaration
<ComVisibleAttribute(True)> _
Public Class ServiceProvider _
    Implements IServiceContainer, IServiceProvider, IServiceProvider
[ComVisibleAttribute(true)]
public class ServiceProvider : IServiceContainer, 
    IServiceProvider, IServiceProvider
[ComVisibleAttribute(true)]
public ref class ServiceProvider : IServiceContainer, 
    IServiceProvider, IServiceProvider
[<ComVisibleAttribute(true)>]
type ServiceProvider =  
    class
        interface IServiceContainer
        interface IServiceProvider
        interface IServiceProvider
    end
public class ServiceProvider implements IServiceContainer, IServiceProvider, IServiceProvider

The ServiceProvider type exposes the following members.

Constructors

  Name Description
Public method ServiceProvider() Initializes a new instance of a managed or unmanaged IServiceProvider.
Public method ServiceProvider(IServiceProvider) Wraps an unmanaged IServiceProvider interface that is accessible through the managed IServiceProvider interface.
Public method ServiceProvider(IServiceProvider) Initializes a new instance of an unmanaged IServiceProvider interface.

Top

Properties

  Name Description
Protected property ParentProvider Gets the current instance of the parent service provider.

Top

Methods

  Name Description
Public method AddService(Type, ServiceCreatorCallback) Adds the specified service to the internal collection of services.
Public method AddService(Type, Object) Adds the specified service to the internal collection of services.
Public method AddService(Type, ServiceCreatorCallback, Boolean) Adds the specified service to the internal collection of services or to the parent service container.
Public method AddService(Type, Object, Boolean) Adds the specified service to the collection of service objects or to the parent service container.
Public method Equals Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected method Finalize Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public method GetHashCode Serves as a hash function for a particular type. (Inherited from Object.)
Public method GetService(Guid) Retrieves a service with a specified service GUID.
Public method GetService(Type) Retrieves a service of the specified type.
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Protected method MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Public method RemoveService(Type) Removes the specified service from the internal services collection
Public method RemoveService(Type, Boolean) Removes the specified service from the internal services collection or from the parent service container.
Public method ToString Returns a string that represents the current object. (Inherited from Object.)

Top

Explicit Interface Implementations

  Name Description
Explicit interface implemetationPrivate method IServiceProvider.QueryService Performs as a factory for services that are exposed through an implementation of IServiceProvider.

Top

Remarks

Note

In the syntax block above, the class inheritance derives from both the managed and the unmanaged IServiceProvider interfaces. That is, the first (unmanaged) derives from the IServiceProvider interface and the second (managed) derives from IServiceProvider.

This class serves two purposes. First, it provides a managed class for creating an implementation of the unmanaged or managed IServiceProvider interfaces. Second, it provides a managed class for wrapping and extending an existing implementation of the unmanaged or managed IServiceProvider interfaces.

For both cases, the managed IServiceProvider interface is also implemented, so managed clients of the object can communicate with the object by using managed-friendly code.

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

Microsoft.VisualStudio.Data.Framework Namespace