本文整理汇总了C#中System.ServiceModel.Description.IWsdlExportExtension接口的典型用法代码示例。如果您正苦于以下问题:C# IWsdlExportExtension接口的具体用法?C# IWsdlExportExtension怎么用?C# IWsdlExportExtension使用的例子?那么恭喜您, 这里精选的接口代码示例或许可以为您提供帮助。
IWsdlExportExtension接口属于System.ServiceModel.Description命名空间,在下文中一共展示了IWsdlExportExtension接口的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: foreach
Console.WriteLine("Inside ExportContract");
if (context.Contract != null)
{
// Inside this block it is the contract-level comment attribute.
// This.Text returns the string for the contract attribute.
// Set the doc element; if this isn't done first, there is no XmlElement in the
// DocumentElement property.
context.WsdlPortType.Documentation = string.Empty;
// Contract comments.
XmlDocument owner = context.WsdlPortType.DocumentationElement.OwnerDocument;
XmlElement summaryElement = Formatter.CreateSummaryElement(owner, this.Text);
context.WsdlPortType.DocumentationElement.AppendChild(summaryElement);
foreach (OperationDescription op in context.Contract.Operations)
{
Operation operation = context.GetOperation(op);
object[] opAttrs = op.SyncMethod.GetCustomAttributes(typeof(WsdlDocumentationAttribute), false);
if (opAttrs.Length == 1)
{
string opComment = ((WsdlDocumentationAttribute)opAttrs[0]).Text;
// This.Text returns the string for the operation-level attributes.
// Set the doc element; if this isn't done first, there is no XmlElement in the
// DocumentElement property.
operation.Documentation = String.Empty;
// Operation C# triple comments.
XmlDocument opOwner = operation.DocumentationElement.OwnerDocument;
XmlElement newSummaryElement = Formatter.CreateSummaryElement(opOwner, opComment);
operation.DocumentationElement.AppendChild(newSummaryElement);
// Get returns information
ParameterInfo returnValue = op.SyncMethod.ReturnParameter;
object[] returnAttrs = returnValue.GetCustomAttributes(typeof(WsdlParameterDocumentationAttribute), false);
if (returnAttrs.Length == 1)
{
// <returns>text.</returns>
XmlElement returnsElement =
Formatter.CreateReturnsElement(
opOwner,
((WsdlParameterDocumentationAttribute)returnAttrs[0]).ParamComment
);
operation.DocumentationElement.AppendChild(returnsElement);
}
// Get parameter information.
ParameterInfo[] args = op.SyncMethod.GetParameters();
for (int i = 0; i < args.Length; i++)
{
object[] docAttrs
= args[i].GetCustomAttributes(typeof(WsdlParameterDocumentationAttribute), false);
if (docAttrs.Length != 0)
{
// <param name="Int1">Text.</param>
XmlElement newParamElement = opOwner.CreateElement("param");
XmlAttribute paramName = opOwner.CreateAttribute("name");
paramName.Value = args[i].Name;
newParamElement.InnerText
= ((WsdlParameterDocumentationAttribute)docAttrs[0]).ParamComment;
newParamElement.Attributes.Append(paramName);
operation.DocumentationElement.AppendChild(newParamElement);
}
}
}
}
}
开发者ID:.NET开发者,项目名称:System.ServiceModel.Description,代码行数:66,代码来源:IWsdlExportExtension
注:本文中的System.ServiceModel.Description.IWsdlExportExtension接口示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论