DataMember and Interface question


  • I've created a class model that is a data contract:

    [DataContract(Name = "OfficeEmployeeDtrModel")]
        public class OfficeEmployeeDtrModel




    I want this class to implement an interface:

    public class OfficeEmployeeDtrModel: IMyInterface


    Problem is, when I add the service reference, I cannot find the interface in the generated service proxy. I was actually doing this so I can use the interface as function arguments in my client as to avoid multiple function blocks. Can anyone advise me as to what to do?

    Tuesday, September 28, 2010 4:18 AM


  • When you create the client you are only sharing the DataContract (the fields and properties marked DataMember), not the implementation.  If you want to use the implementation in the client you will need to share an assembly between the client and the service.
    • Marked as answer by manduz_griffus Wednesday, September 29, 2010 6:27 AM
    Tuesday, September 28, 2010 11:10 PM