I'm attempting to split up my WCF web services into a few services instead of 1 giant service. But the Visual Studio (Silverlight client) duplicates the common classes shared by both services. Here is a simple example to illustrate my problem.
In this example there are two services. Both return the type "Person". By default VS will create two seperate Person proxy's under unique NameSpaces. This means that the "Person" returned by the different services cannot be consumed by the client as the same thing. How do I fix this? Is it possible without writing the proxy classes myself?
Common
[DataContract]
public class Person
{
[DataMember]
string FirstName { get; set; }
[DataMember]
string LastName { get; set; }
[DataMember]
string PrivateData { get; set; }
}
StaffService.svc
[ServiceContract(Namespace = "")]
public class StaffService
{
[OperationContract]
public Person GetPerson ()
{
return new Person {"John", "Doe", "secret"};
};
}
PublicService.svc
[ServiceContract(Namespace = "")]
public class PublicService
{
[OperationContract]
public Person GetPerson ()
{
return new Person {"John", "Doe", "*****"};
};
}
Thanks for you help! Justin