What’s the point of a DataContract in WCF?

The DataContract is just a formal definition of a type that can be understood on both sides of the service boundary.

If you return, as in your example, a “MyUserCollection” object, the consumers of your service will need to reference the innards of your service/system, which is a violation of the SOA tenet of explicit boundaries. By using a DataContract, you are publishing the structure of your return types in a loosely-coupled way.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)