Compartilhar via


IVsDataSupportImportResolver Interface

Provides the ability to resolve Import statements in a stream of data support XML.

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

Syntax

'Declaration
Public Interface IVsDataSupportImportResolver
public interface IVsDataSupportImportResolver
public interface class IVsDataSupportImportResolver
type IVsDataSupportImportResolver =  interface end
public interface IVsDataSupportImportResolver

The IVsDataSupportImportResolver type exposes the following members.

Methods

  Name Description
Public method ImportSupportStream Imports and returns a stream of data support XML that is identified with a specified name.

Top

Remarks

The DDEX architecture is mainly data driven for complex areas of extensibility, such as representing the data source as an object model or in a hierarchical view. To achieve this, a support entity has been created that inherits from the IVsDataSupport interface. The purpose of this support entity is to return a stream of XML that matches a known schema to the caller. The various XML schemas follow a pattern allowing for reuse of XML fragments that may come from within the main stream or from an imported stream referenced by name. This interface, when implemented on the same object that implements the IVsDataSupport interface, allows for resolution and loading of these imported streams.

Examples

The following code demonstrates a possible implementation of this interface in the context of supplying support for viewing the data source as an object model. In this example, assume that the stream of XML in MyObjectSupport.xml contains an Import element with the name MyObjectDefines.

using System;
using System.IO;
using Microsoft.VisualStudio.Data.Core;
using Microsoft.VisualStudio.Data.Services.SupportEntities;

internal class MyObjectSupport
    : IVsDataObjectSupport, // inherits from IVsDataSupport
      IVsDataSupportImportResolver
{
    public Stream OpenSupportStream()
    {
        return GetType().Assembly.GetManifestResourceStream(
            "MyObjectSupport.xml");
    }

    public Stream ImportSupportStream(string name)
    {
        if (String.Equals(name, "MyObjectDefines"))
        {
            return GetType().Assembly.GetManifestResourceStream(
                "MyObjectDefines.xml");
        }
        return null;
    }
}

See Also

Reference

Microsoft.VisualStudio.Data.Core Namespace