WCF service reference creates a second class

I am creating a service link to a WCF service using VS2008, but the generated link file has 2 classes defined for one object. Any ideas why this would be? See Result below - THView and THView1 were created while I expect only THView.

[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "3.0.0.0")]
[System.Runtime.Serialization.DataContractAttribute(Name="THView", Namespace="http://schemas.datacontract.org/2004/07/CH.BusinessServices.Model")]
[System.SerializableAttribute()]
public partial class THView : object, System.Runtime.Serialization.IExtensibleDataObject, System.ComponentModel.INotifyPropertyChanged {

[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "3.0.0.0")]
[System.Runtime.Serialization.DataContractAttribute(Name="THView", Namespace="http://tempuri.org/")]
[System.SerializableAttribute()]
public partial class THView1 : object, System.Runtime.Serialization.IExtensibleDataObject, System.ComponentModel.INotifyPropertyChanged {
+3
source share
2 answers

Service files are created based on service metadata (WSDL), and this particular service metadata automatically defines two different types of THView.

They may look the same (they have the same name), but they are actually different because they live in two different namespaces (note the NamespaceDataContractAttribute property ), respectively

  • http://schemas.datacontract.org/2004/07/CH.BusinessServices.Model
  • http://tempuri.org/

, . , XML.

, , , XML , , - , http://tempuri.org/ - WCF.

, , .

+2

, , app.config, , app.config - -

, Sebastian

0

Source: https://habr.com/ru/post/1727263/


All Articles