gpt4 book ai didi

c# - 了解 WCF 响应中的 xmlns 标记

转载 作者:太空宇宙 更新时间:2023-11-03 15:49:33 26 4
gpt4 key购买 nike

<分区>

我正在尝试修改 WCF 服务,但我在理解响应中的 namespace 和 xmlns 标记时遇到问题。

这个数据类型在 Iservice 文件中,并且有一个命名空间的标签:

[System.CodeDom.Compiler.GeneratedCodeAttribute("svcutil", "3.0.4506.2152")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://www.zz.com/x/Domain")]
public partial class DiscrepancyType
{

private string barcodeField;

private string classificationField;

private bool commentRequiredField;

private string descriptionField;

private int discrepancyTypeIdField;

private System.Nullable<int> usageRankField;

private string useCaseIdField;

/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Order=0)]
public string Barcode
{
get
{
return this.barcodeField;
}
set
{
this.barcodeField = value;
}
}

/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Order=1)]
public string Classification
{
get
{
return this.classificationField;
}
set
{
this.classificationField = value;
}
}

/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Order=2)]
public bool CommentRequired
{
get
{
return this.commentRequiredField;
}
set
{
this.commentRequiredField = value;
}
}

/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Order=3)]
public string Description
{
get
{
return this.descriptionField;
}
set
{
this.descriptionField = value;
}
}

/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Order=4)]
public int DiscrepancyTypeId
{
get
{
return this.discrepancyTypeIdField;
}
set
{
this.discrepancyTypeIdField = value;
}
}

/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(IsNullable=true, Order=5)]
public System.Nullable<int> UsageRank
{
get
{
return this.usageRankField;
}
set
{
this.usageRankField = value;
}
}

/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Order=6)]
public string UseCaseId
{
get
{
return this.useCaseIdField;
}
set
{
this.useCaseIdField = value;
}
}
}

在响应中,我得到以下结果。我不明白为什么我在每个属性中都有 xlmns 标记,我只想在 DiscrepancyType 标记中包含该域。我该如何解决这个问题?

<DiscrepancyType>
<Barcode xmlns="http://www.zz.com/x/Domain"></Barcode>
<Classification xmlns="http://www.zz.com/x/Domain"></Classification>
<CommentRequired xmlns="http://www.zz.com/x/Domain"></CommentRequired>
<Description xmlns="http://www.zz.com/x/Domain"></Description>
<DiscrepancyTypeId xmlns="http://www.zz.com/x/Domain"></DiscrepancyTypeId>
<UsageRank xmlns="http://www.zz.com/x/Domain"></UsageRank>
<UseCaseId xmlns="http://www.zz.com/x/Domain"></UseCaseId>
</DiscrepancyType>

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com