IVsWCFMetadataStorageProvider 接口

为项目系统的保存的 windows communication foundation (WCF) 服务元数据提供一个接口。

命名空间:  Microsoft.VisualStudio.WCFReference.Interop
程序集:  Microsoft.VisualStudio.WCFReference.Interop(在 Microsoft.VisualStudio.WCFReference.Interop.dll 中)

语法

声明
<GuidAttribute("F71D2B05-680F-423B-B00F-52A2944AC45C")> _
<InterfaceTypeAttribute()> _
Public Interface IVsWCFMetadataStorageProvider
[GuidAttribute("F71D2B05-680F-423B-B00F-52A2944AC45C")]
[InterfaceTypeAttribute()]
public interface IVsWCFMetadataStorageProvider
[GuidAttribute(L"F71D2B05-680F-423B-B00F-52A2944AC45C")]
[InterfaceTypeAttribute()]
public interface class IVsWCFMetadataStorageProvider
[<GuidAttribute("F71D2B05-680F-423B-B00F-52A2944AC45C")>]
[<InterfaceTypeAttribute()>]
type IVsWCFMetadataStorageProvider =  interface end
public interface IVsWCFMetadataStorageProvider

IVsWCFMetadataStorageProvider 类型公开以下成员。

方法

  名称 说明
公共方法 AdviseWCFMetadataStorageProviderEvents 注册元数据存储提供程序事件通知的调用方。
公共方法 CreateStorage 创建新的 windows communication foundation (WCF) 元数据存储。
公共方法 GetStorageFromMapFile 返回基于 .svcmap 文件的完整路径的 windows communication foundation (WCF) 元数据存储。
公共方法 GetStorages 枚举 windows communication foundation (WCF) 项目中的元数据存储。
公共方法 IsValidNewReferenceName 返回确定的值的名称 windows 服务引用的 communication foundation (WCF) 是否是唯一的。
公共方法 MakeValidReferenceName 返回一个唯一名称,并且 windows communication foundation (WCF) 服务的命名空间引用。
公共方法 UnadviseWCFMetadataStorageProviderEvents 移除元数据存储提供程序事件通知的注册。

页首

备注

项目系统必须实现此接口。 调用此接口可创建新的存储保存服务引用组或模拟在项目的现有的存储。

项目系统必须确定正确的目录结构存储其元数据。

示例

下面的示例使用 IVsWCFMetadataStorageProvider 界面确定哪些项目是否支持 WCF 服务引用。

/// Helper method to determine if WCF ServiceReferences are
/// supported by the given hierarchy.
private static bool
 ServiceReferencesSupported(IVsWCFReferenceManagerFactory factory,
 IVsHierarchy hierarchy)
{
    if (hierarchy != null)
    {

        // Try to see if Reference Manager Factory supports it. 
        if
 (!Convert.ToBoolean(factory.IsReferenceManagerSupported(hierarchy)))
        {
            return false;
        }
        /// If factory supports, then ask Hierarchy. They both need to 
        /// support it.
        if ((hierarchy as IVsWCFMetadataStorageProvider) != null)
        {
            try
            {
                object objIsServiceReferenceSupported;
                ErrorHandler.ThrowOnFailure(hierarchy.GetProperty
 (Microsoft.VisualStudio.VSConstants.VSITEMID_ROOT,
 (int)__VSHPROPID3.VSHPROPID_ServiceReferenceSupported,
 out objIsServiceReferenceSupported));
                if (objIsServiceReferenceSupported != null &&
 objIsServiceReferenceSupported is bool)
                {
                    return (bool)objIsServiceReferenceSupported;
                }
            }
            catch (NotImplementedException)
            {
                // If the property isn't implemented in the current 
                // project system, then we know that
                // service references aren't supported.
            }
        }
    }
    return false;
}

请参阅

参考

Microsoft.VisualStudio.WCFReference.Interop 命名空间