I have two WCF services on my project. Services are sharing one type, but each service generating its own type. Is it possible to generate one class for both services?
Sample code for server side:
[DataContract]
class MyClass { /*some properties*/ }
[ServiceContract]
public interface IService1
{
[OperationContract]
MyClass GetSomeValue();
}
public class Service1 : IService1
{
public MyClass GetSomeValue() { /*some logic*/ }
}
[ServiceContract]
public interface IService2
{
[OperationContract]
MyClass GetSomeOtherValue();
}
public class Service2 : IService2
{
public MyClass GetSomeOtherValue() { /*some logic*/ }
}
On client side two "MyClass" are generating for each service:
namespace Services.Service1Reference {
[System.SerializableAttribute()]
public partial class RSTRole : object, System.Runtime.Serialization.IExtensibleDataObject, System.ComponentModel.INotifyPropertyChanged
{
}
and
namespace Services.Service2Reference {
[System.SerializableAttribute()]
public partial class RSTRole : object, System.Runtime.Serialization.IExtensibleDataObject, System.ComponentModel.INotifyPropertyChanged
{
}