Below is my base class WCF DataContract
[DataContract]
public class BaseClass
{
}
And here is my derived class ....
[DataContract]
public class DerivedClass1 : BaseClass
{
[DataMember]
public string ProductName{get;set;}
}
Due to some change in requirements, I am adding another derived type that also has the same ProductName property.
So, the code structure is now ...
[DataContract]
public class BaseClass
{
[DataMember]
public string ProductName{get;set;}
}
[DataContract]
public class DerivedClass1 : BaseClass
{
}
[DataContract]
public class DerivedClass2 : BaseClass
{
}
so I moved the "ProductName" property to the base class. But now, when an existing datacontract is called from a client that returns a list of Derivedclass1 to me, I do not see productName in response. One way or another, my DerivedClass1 does not enter the productName property from the database. What could be the reason? Can I make mistakes when writing code?
source
share