Share via


VsModelingAdapterManager.DoCreateAdapter Method (ModelBusReference, IServiceProvider)

 

Using the ModelBusReference passed as a parameter, creation of a ModelBusAdapter instance is attempted. If successful, the adapter is returned. If not, appropriate exception is thrown.

Namespace:   Microsoft.VisualStudio.Modeling.Integration.Shell
Assembly:  Microsoft.VisualStudio.Modeling.Sdk.Integration.Shell.12.0 (in Microsoft.VisualStudio.Modeling.Sdk.Integration.Shell.12.0.dll)

Syntax

protected override ModelBusAdapter DoCreateAdapter(
    ModelBusReference reference,
    IServiceProvider serviceProvider
)
protected:
virtual ModelBusAdapter^ DoCreateAdapter(
    ModelBusReference^ reference,
    IServiceProvider^ serviceProvider
) override
override DoCreateAdapter : 
        reference:ModelBusReference *
        serviceProvider:IServiceProvider -> ModelBusAdapter
Protected Overrides Function DoCreateAdapter (
    reference As ModelBusReference,
    serviceProvider As IServiceProvider
) As ModelBusAdapter

Parameters

  • serviceProvider
    Type: System.IServiceProvider

    Used to create association between the caller and the referenced model. The serviceProvider can be null, but if it is not null then it must provide the SRelatedDocList service otherwise an exception will be thrown

Return Value

Type: Microsoft.VisualStudio.Modeling.Integration.ModelBusAdapter

The created non-null ModelBusAdapter instance if successful, exception will be thrown otherwise.

Remarks

If an IServiceProvider is supplied it must be able to lookup the Microsoft.VisualStudio.Modeling.Shell.SRelatedDocList service otherwise an exception will be thrown. This serviceProvider, if supplied, will be used to facilitate association between the created ModelBusAdapter and the caller. This is a private protocol implemented by this AdapterManager with its callers. The SRelatedDocList service will be used to link the saving of the caller's document with the saving of Model wrapped by the Adapter created through this API. For instance, this will trigger a save on the referenced model, when the caller's Document is itself saved in Visual Studio.

See Also

VsModelingAdapterManager Class
Microsoft.VisualStudio.Modeling.Integration.Shell Namespace

Return to top