I have a Java web server that has 2 endpoints: SystemManagement and UserManagement. The 2 endpoints use the same libraries. Therefore, almost all the classes in that two endpoints are identical.
And I have a C# client side that uses that 2 services. I know that WCF can share classes. So I make a new project and let my client project reference to the new project. Then make a common class "session" in the new project.
namespace WcfExplore.UserManagement
{
[DataContract]
public partial class session : object, System.ComponentModel.INotifyPropertyChanged
{
private string sessionIdField;
private string useridField;
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified, Order = 3)]
[DataMember]
public string sessionId
{
get { return this.sessionIdField; }
set
{
this.sessionIdField = value;
this.RaisePropertyChanged("sessionId");
}
}
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified, Order = 4)]
[DataMember]
public string userid
{
get { return this.useridField; }
set
{
this.useridField = value;
this.RaisePropertyChanged("userid");
}
}
public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
protected void RaisePropertyChanged(string propertyName)
{
System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged;
if (propertyChanged != null)
propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
}
}
}
But when I update the service references, the visual studio still generates the class "session" by its own.
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.225")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://iboss2.service.iasia.com/")]
public partial class session : object, System.ComponentModel.INotifyPropertyChanged {
private string sessionIdField;
private string useridField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Order=3)]
public string sessionId {
get {
return this.sessionIdField;
}
set {
this.sessionIdField = value;
this.RaisePropertyChanged("sessionId");
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Order=4)]
public string userid {
get {
return this.useridField;
}
set {
this.useridField = value;
this.RaisePropertyChanged("userid");
}
}
public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
protected void RaisePropertyChanged(string propertyName) {
System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged;
if ((propertyChanged != null)) {
propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
}
}
}
What to do to make the 2 service references use the common class? I don't want the 2 service references generating their own class which is duplicated.