Do we need DataContract attribute on POCO classes

2019-04-02 07:22发布

I read somewhere in stackoverflow itself that when we use POCO classes for WCF contracts using Poco generator , we need not use DataContract and DataMember attributes.WCF do it auto for you? . I don't know how it manages this.

I created a sample application without using these attributes and I was able to generate those entities on client side and use them. I disabled proxy generation and Lazy loading.

Am i missing anything here.? Is there really no need of putting these attributes.

1条回答
forever°为你锁心
2楼-- · 2019-04-02 08:28

You did it right way. Since WCF 3.5 SP1 it is not needed to add DataContract and DataMember attributes. If attributes are not used all properties with public getter and setter are serialized.

查看更多
登录 后发表回答