Hi,
I have a strange problem that's happening with my WCF REST service. For an operation where it accepts data, let's say it accepts the Foo class:
[WebInvoke(Method = "PUT", UriTemplate = "users/{username}")]
[OperationContract]
public void UpdateLoginUser(string username, LoginUser userUpdated) {
[...]
}
Now my LoginUser class inherits from my NormalUser class:
<DataContract()> _
Public MustInherit Class NormalUser
[...]
End Class
Public Class LoginUser
Inherits NormalUser
[...]
End Class
When I PUT to my service, triggering UpdateLoginUser, everything works OK. However, if I apply DataContract to my NormalUser class:
<DataContract()> _
Public Class LoginUser
Inherits NormalUser
[...]
End Class
... suddenly, the LoginUser class's constructor doesn't fire during deserialization! I have business login rules in there I need to run. So, why is it that when I apply the DataContract attribute to my inherited class, its constructor stops getting fired? How can I get around this? If I want to change namespace or name, I do need to apply the DataContract attribute.