IVsDataHostService Interface
Provides the DDEX Host service.
Namespace: Microsoft.VisualStudio.Data.Core
Assembly: Microsoft.VisualStudio.Data.Core (in Microsoft.VisualStudio.Data.Core.dll)
Syntax
'Déclaration
<GuidAttribute("42B51AD0-12B8-409f-BB67-1A381CCAD02E")> _
Public Interface IVsDataHostService
[GuidAttribute("42B51AD0-12B8-409f-BB67-1A381CCAD02E")]
public interface IVsDataHostService
[GuidAttribute(L"42B51AD0-12B8-409f-BB67-1A381CCAD02E")]
public interface class IVsDataHostService
[<GuidAttribute("42B51AD0-12B8-409f-BB67-1A381CCAD02E")>]
type IVsDataHostService = interface end
public interface IVsDataHostService
The IVsDataHostService type exposes the following members.
Properties
Name | Description | |
---|---|---|
UIThread | Gets the main (UI) thread running in the Visual Studio process. |
Top
Methods
Name | Description | |
---|---|---|
BeginInvokeOnUIThread | Asynchronously executes a specified method on the main (UI) thread running in the Visual Studio process, with the specified list of arguments. | |
GetService<T>() | Gets a global Visual Studio service of the specified type. | |
GetService<T>(Guid) | Gets a global Visual Studio service that is registered with the specified class ID that implements the specified interface. | |
GetService<TService, TInterface>() | Gets a global Visual Studio service of the specified type that implements the specified interface. | |
InvokeOnUIThread | Synchronously executes a specified method on the main thread running in the Visual Studio process, with the specified list of arguments. | |
TryGetService<T>() | Tries to get a global Visual Studio service of the specified type. | |
TryGetService<T>(Guid) | Tries to get a global Visual Studio service that is registered with the specified class ID that implements the specified interface. | |
TryGetService<TService, TInterface>() | Tries to get a global Visual Studio service of the specified type that implements the specified interface. |
Top
Remarks
The DDEX Host service offers a managed way to access global Visual Studio services through a variety of generic methods. This service is easier to call than the QueryService method on the underlying native IServiceProvider implementation supplied by the Visual Studio environment. This service also supplies members that become important when you are carrying out asynchronous operations that are synchronous with the UI thread.
The DDEX Host service is a global Visual Studio service registered with the environment and can thus be accessed by requesting the service from a global service provider object.
Examples
The following code demonstrates how a client can retrieve the DDEX Host service from a global Visual Studio service provider and then retrieve an additional service by using one of the generic methods.
using System;
using System.Diagnostics;
using Microsoft.VisualStudio.Data.Core;
using Microsoft.VisualStudio.Shell.Interop;
public class DdexHostSvcExample1
{
public static IVsUIShell GetIVsUIShell(IServiceProvider serviceProvider)
{
IVsDataHostService hostService = serviceProvider.GetService(
typeof(IVsDataHostService)) as IVsDataHostService;
return hostService.GetService<IVsUIShell>();
}
}