C# 将HTML嵌入System.ComponentModel.DescriptionAttribute.Description
我正在尝试将HTML(特别是href)嵌入到DescriptionAttribute中,以将自动生成的WCF帮助文档中的链接添加到一个更详细的SandCastle生成的页面,该页面描述了所涉及的数据结构。大致如下:C# 将HTML嵌入System.ComponentModel.DescriptionAttribute.Description,c#,wcf,.net-4.0,C#,Wcf,.net 4.0,我正在尝试将HTML(特别是href)嵌入到DescriptionAttribute中,以将自动生成的WCF帮助文档中的链接添加到一个更详细的SandCastle生成的页面,该页面描述了所涉及的数据结构。大致如下: [Description( "Creates jobs. A detailed description of the Jobs data structure can " + "be found <a href=\"http://www.example.com/a
[Description(
"Creates jobs. A detailed description of the Jobs data structure can " +
"be found <a href=\"http://www.example.com/api/docs/jobs\">here.</a>")]
[WebInvoke(UriTemplate = "Jobs", Method = "POST")]
public Jobs CreateJobs(Jobs jobs)
{
...
}
但是将断点放入重写属性中,我发现在这个阶段它还没有编码。因此,无论调用这个属性的是什么,都应该添加编码
有人知道是否/如何做到这一点吗
谢谢 修改(或检索)DescriptionValue而不是描述是否有帮助@deltree-DescriptionValue似乎包含完全相同的字符串。看起来这个类与添加角色实体无关。它由System.ServiceModel.Description.WebHttpBehavior.GetDescription()调用。我想知道这是否可以被覆盖?显示文档的是什么?浏览器。它是WCF自动生成的服务文档。我的实际实现在这里:像这样?
<td>Creates jobs. A detailed description of the Jobs data structure can be found <a href="http://www.example.com/api/docs/jobs\">here.</a></td>
class HtmlDescriptionAttribute : System.ComponentModel.DescriptionAttribute
{
public override string Description
{
get
{
string description = base.Description;
//
// Remove encoding from description here
//
return description;
}
}
public HtmlDescriptionAttribute() : base() { }
public HtmlDescriptionAttribute(string description) : base(description) { }
}