次の方法で共有


IVsWCFMetadataStorageProvider Interface

Provides an interface for saving Windows Communication Foundation (WCF) service metadata in the project system.

Namespace:  Microsoft.VisualStudio.WCFReference.Interop
Assembly:  Microsoft.VisualStudio.WCFReference.Interop (in Microsoft.VisualStudio.WCFReference.Interop.dll)

Syntax

'宣言
<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

The IVsWCFMetadataStorageProvider type exposes the following members.

Methods

  Name Description
Public method AdviseWCFMetadataStorageProviderEvents Registers the caller for metadata storage provider event notification.
Public method CreateStorage Creates a new Windows Communication Foundation (WCF) metadata storage.
Public method GetStorageFromMapFile Returns a Windows Communication Foundation (WCF) metadata storage based on the full path of a .svcmap file.
Public method GetStorages Enumerates Windows Communication Foundation (WCF) metadata storages in a project.
Public method IsValidNewReferenceName Returns a value that determines whether a name for a Windows Communication Foundation (WCF) service reference is unique.
Public method MakeValidReferenceName Returns a unique name and namespace for a Windows Communication Foundation (WCF) service reference.
Public method UnadviseWCFMetadataStorageProviderEvents Cancels registration for metadata storage provider event notification.

Top

Remarks

Project systems must implement this interface. Call this interface to create a new storage to save a service reference group, or emulate existing storages in the project.

The project system must determine the correct directory structure to store its metadata.

Examples

The following example uses the IVsWCFMetadataStorageProvider interface to determine whether a project supports WCF service references.

/// 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;
}

See Also

Reference

Microsoft.VisualStudio.WCFReference.Interop Namespace