Why is the Inherited Class not exposed when I use this WCF Service Class?
[ServiceContract]
public interface IMyService
{
[OperationContract] void DoSomething();
}
[DataContract]
public abstract class InheritMe
{
[DataMember] public int ExposeMe { get; set; }
}
public class MyService : InheritMe, IMyService
{
public void DoSomething() { }
}
My code is in C#, in Framework 4, build in Visual Studio 2010 Pro.
Please help, Thanks in advance.
ExposeMeis not part of the service contract. If you expect to be able to call it in client applicaitons, then you have to define it in the contract interfaceIMyService.It’s is a little wierd to have your service class (
MyService) inherit from aDataContract. This serves no purpose.DataContactclasses are classes that you can communicate to the client (by returning them from your service operations for example).The
MyServiceclass is just the implementation of your service contract – it is not visible to the client.