VsModelingAdapterManager.DoCreateAdapter Method
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.10.0 (in Microsoft.VisualStudio.Modeling.Sdk.Integration.Shell.10.0.dll)
Syntax
'Declaration
Protected Overrides Function DoCreateAdapter ( _
reference As ModelBusReference, _
serviceProvider As IServiceProvider _
) As ModelBusAdapter
protected override ModelBusAdapter DoCreateAdapter(
ModelBusReference reference,
IServiceProvider serviceProvider
)
protected:
virtual ModelBusAdapter^ DoCreateAdapter(
ModelBusReference^ reference,
IServiceProvider^ serviceProvider
) override
abstract DoCreateAdapter :
reference:ModelBusReference *
serviceProvider:IServiceProvider -> ModelBusAdapter
override DoCreateAdapter :
reference:ModelBusReference *
serviceProvider:IServiceProvider -> ModelBusAdapter
protected override function DoCreateAdapter(
reference : ModelBusReference,
serviceProvider : IServiceProvider
) : ModelBusAdapter
Parameters
- reference
Type: Microsoft.VisualStudio.Modeling.Integration.ModelBusReference
Reference that will be used to created the ModelBusAdapter
- 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.
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.