Compartilhar via


AsyncServiceProvider Class

Definition

An asynchronous service provider.

public ref class AsyncServiceProvider sealed : IDisposable, Microsoft::VisualStudio::OLE::Interop::IObjectWithSite, Microsoft::VisualStudio::Shell::IAsyncServiceProvider
public ref class AsyncServiceProvider sealed : IDisposable, Microsoft::VisualStudio::OLE::Interop::IObjectWithSite, Microsoft::VisualStudio::Shell::IAsyncServiceProvider2
[System.Runtime.InteropServices.ComVisible(true)]
public sealed class AsyncServiceProvider : IDisposable, Microsoft.VisualStudio.OLE.Interop.IObjectWithSite, Microsoft.VisualStudio.Shell.IAsyncServiceProvider
[System.Runtime.InteropServices.ComVisible(true)]
public sealed class AsyncServiceProvider : IDisposable, Microsoft.VisualStudio.OLE.Interop.IObjectWithSite, Microsoft.VisualStudio.Shell.IAsyncServiceProvider2
[<System.Runtime.InteropServices.ComVisible(true)>]
type AsyncServiceProvider = class
    interface IAsyncServiceProvider
    interface IDisposable
    interface IObjectWithSite
[<System.Runtime.InteropServices.ComVisible(true)>]
type AsyncServiceProvider = class
    interface IAsyncServiceProvider2
    interface IAsyncServiceProvider
    interface IDisposable
    interface IObjectWithSite
Public NotInheritable Class AsyncServiceProvider
Implements IAsyncServiceProvider, IDisposable, IObjectWithSite
Public NotInheritable Class AsyncServiceProvider
Implements IAsyncServiceProvider2, IDisposable, IObjectWithSite
Inheritance
AsyncServiceProvider
Attributes
Implements

Constructors

AsyncServiceProvider(IAsyncServiceProvider, Boolean)

Creates a new AsyncServiceProvider object and uses the given interface to resolve services. If defaultServices is true (the default used by the ctor that doesn't take a 'defaultServices' parameter) this service provider will respond to IObjectWithSite as a service. A query for IObjectWithSite will return this object. If false is passed in for defaultServices this service will not be provided and the service provider will be "transparent".

AsyncServiceProvider(IAsyncServiceProvider, Boolean)

Creates a new AsyncServiceProvider object and uses the given interface to resolve services. If defaultServices is true (the default used by the ctor that doesn't take a 'defaultServices' parameter) this service provider will respond to IObjectWithSite as a service. A query for IObjectWithSite will return this object. If false is passed in for defaultServices this service will not be provided and the service provider will be "transparent".

AsyncServiceProvider(IAsyncServiceProvider)

Creates a new AsyncServiceProvider chaining to the other ctor and providing 'true' for the 'defaultServices' parameter.

AsyncServiceProvider(IAsyncServiceProvider)

Creates a new AsyncServiceProvider chaining to the other ctor and providing 'true' for the 'defaultServices' parameter.

Properties

GlobalProvider

Gets the global provider.

Methods

CreateFromSetSite(IAsyncServiceProvider)

Create a new AsyncServiceProvider for the given site. Should be called from an object that implements SetSite (IObjectWithSite or IVsPackage). Automatically sets the global async service provider if it hasn't already been set. This method is typically called from the SetSite method of a Visual Studio package. Note: By calling this method, the caller declares that it knows the global async service provider and that the AsyncServiceProvider instance returned may be used by other, unrelated components, accessed via the AsyncServiceProvider.GlobalProvider static property.

CreateFromSetSite(IAsyncServiceProvider)

Create a new AsyncServiceProvider for the given site. Should be called from an object that implements SetSite (IObjectWithSite or IVsPackage). Automatically sets the global async service provider if it hasn't already been set. This method is typically called from the SetSite method of a Visual Studio package. Note: By calling this method, the caller declares that it knows the global async service provider and that the AsyncServiceProvider instance returned may be used by other, unrelated components, accessed via the AsyncServiceProvider.GlobalProvider static property.

Dispose()

Disposes the object.

GetServiceAsync(Type, Boolean)
GetServiceAsync(Type)
QueryServiceAsync(Guid)
QueryServiceAsync(Type)

Explicit Interface Implementations

IObjectWithSite.GetSite(Guid, IntPtr)

Gets the service provider.

IObjectWithSite.SetSite(Object)

Sets the service provider.

Extension Methods

GetServiceAsync<TService,TInterface>(IAsyncServiceProvider, Boolean, CancellationToken)

Retrieves a proffered service asynchronously, specifying whether to throw an exception if it could not be retrieved.

GetServiceAsync<TService,TInterface>(IAsyncServiceProvider, Boolean)

Retrieves a proffered service asynchronously, specifying whether to throw an exception if it could not be retrieved.

GetServiceAsync<TService,TInterface>(IAsyncServiceProvider, CancellationToken)

Retrieves a proffered service asynchronously, throwing an exception if it could not be retrieved.

GetServiceAsync<TService,TInterface>(IAsyncServiceProvider)

Retrieves a proffered service asynchronously, throwing an exception if it could not be retrieved.

Applies to