2010-05-26 55 views
1

当我自动生成我的客户端类时,我获得了这些属性。WCF:DataContractAttribute和Namespace

<System.Diagnostics.DebuggerStepThroughAttribute(), _ 
System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0"), _ 
System.Runtime.Serialization.DataContractAttribute(Name:="FeedStatusReport", [Namespace]:="http://schemas.datacontract.org/2004/07/OfferingSystem"), _ 
System.SerializableAttribute()> 

在服务器端,如何更改客户端所看到的名称空间?

回答

2

使用此与您的ServiceContract:

[ServiceContract(Namespace="http://someNameSpaceGoesHere/")] 
public interface ISomeService 
{ 
... 
} 
+1

关闭。您还需要将DataContractAttribute放置在所有非主要类型上。 – 2010-05-26 19:37:25

+0

@Jonathon Allen - 你确定这是对的吗? Primative类型不需要DataContractAttribute?你有任何参考?谢谢。 – 2011-05-13 09:13:07