subclassing and data contracts
Posted
by
Sergio Romero
on Stack Overflow
See other posts from Stack Overflow
or by Sergio Romero
Published on 2011-11-24T01:31:55Z
Indexed on
2011/11/24
1:50 UTC
Read the original article
Hit count: 370
I'm playing with the following code:
[ServiceContract]
public interface IUserAccountService
{
[OperationContract]
UserAccountResponse CreateNewUserAccount(UserAccountRequest userAccountRequest);
}
public abstract class BaseResponse
{
public bool Success { get; set; }
public string Message { get; set; }
}
public class UserAccountResponse : BaseResponse
{
public int NewUserId { get; set; }
}
My questions are:
- Do I need to add the DataContract attribute to both the abstract class and the subclass?
- If the abstract class does not need the DataContract attribute, can I add the DataMember attribure to its properties?
© Stack Overflow or respective owner