Say I have the following:
namespace SomeProject
{
public interface ISomething
{
string SomeMethod();
}
}
namespace SomeService
{
[DataContract]
public class CompositeType
{
[DataMember]
public ISomething Something { get; set; }
}
}
Now, in my calling code I want to be able to do this:
SomeService service = new SomeService();
service.Something.SomeMethod();
SomeMethod()
is not available unless I return the DataMember as the implementation rather than the interface. Is there a way to do this?
This is not how you want to use your WCF service. WCF is about transferring data, not implementation. You are confusing your client and your service layers by doing this.
However, if you really want to do this, you can tell the proxy generator in the client to re-use any existing types... this means that you can
Again, I do not recommend doing it this way.