subclassing and data contracts
- by Sergio Romero
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?