MetadataExporter.State Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets a dictionary of objects used in the export of metadata.
public:
property System::Collections::Generic::Dictionary<System::Object ^, System::Object ^> ^ State { System::Collections::Generic::Dictionary<System::Object ^, System::Object ^> ^ get(); };
public System.Collections.Generic.Dictionary<object,object> State { get; }
member this.State : System.Collections.Generic.Dictionary<obj, obj>
Public ReadOnly Property State As Dictionary(Of Object, Object)
Property Value
A dictionary of objects used by the importer to export contracts and endpoints.
Examples
The following code example is an IWsdlExportExtension.ExportContract method that demonstrates how the State property of the derived class WsdlImporter is used to attach a custom System.Runtime.Serialization.XsdDataContractExporter that modifies the export of data contracts in the endpoint.
public void ExportContract(WsdlExporter exporter, WsdlContractConversionContext context)
{
// Add a custom DCAnnotationSurrogate to write data contract comments into the XSD.
object dataContractExporter;
XsdDataContractExporter xsdDCExporter;
if (!exporter.State.TryGetValue(typeof(XsdDataContractExporter), out dataContractExporter))
{
xsdDCExporter = new XsdDataContractExporter(exporter.GeneratedXmlSchemas);
exporter.State.Add(typeof(XsdDataContractExporter), xsdDCExporter);
}
else
{
xsdDCExporter = (XsdDataContractExporter)dataContractExporter;
}
if (xsdDCExporter.Options == null)
xsdDCExporter.Options = new ExportOptions();
xsdDCExporter.Options.DataContractSurrogate = new DCAnnotationSurrogate();
Remarks
Use the State
property to pass a MetadataExporter state data required to successfully export endpoints or contracts.
Applies to
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應