Share via


ServiceProvider Class

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

Inheritance Hierarchy

System.Object
  Microsoft.VisualStudio.Data.ServiceProvider
    Microsoft.VisualStudio.Data.DataConnection
    Microsoft.VisualStudio.Data.ServiceProviderWithSite

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

Syntax

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

The ServiceProvider type exposes the following members.

Constructors

  Name Description
Protected method ServiceProvider() Class constructor for a managed service provider (IServiceProvider) that is accessible through the unmanaged IServiceProvider interface.
Public method ServiceProvider(IServiceProvider) Class constructor for wrapping an unmanaged IServiceProvider interface that is accessible through the managed IServiceProvider interface.

Top

Properties

  Name Description
Protected property ServiceTypes Retrieves a list of service types used to convert the unmanaged QueryService method call, in which a service GUID is specified, into a managed IServiceProvider.GetService method call, in which a managed type is specified.

Top

Methods

  Name Description
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 the default hash function. (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.
Protected method GetServiceImpl(Guid) Provides the implementation for retrieving a service with a specific GUID.
Protected method GetServiceImpl(Type) Provides the implementation for retrieving a service of a specific 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 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) is IServiceProvider interface and the second (managed) is IServiceProvider.

This class serves two purposes. First, it provides a managed wrapper around the unmanaged IServiceProvider interface. Second, it provides a managed base class for implementing the unmanaged IServiceProvider interface.

For both cases, the managed IServiceProvider interface is also implemented, so managed clients of the object can communicate with the object 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 Namespace