Section C.4. Data Contracts


C.4. Data Contracts

  1. Use the DataMemberAttribute on properties or read-only public members only.

  2. Avoid explicit XML serialization on your own types.

  3. When using the Order property, assign the same value to all members coming from the same level in the class hierarchy.

  4. Support IExtensibleDataObject on your data contracts.

  5. Avoid setting IgnoreExtensionDataObject on the ServiceBehavior and CallbackBehavior attributes to TRue. Keep the default of false.

  6. Do not mark delegates and events as data members.

  7. Do not pass .NET-specific types, such as Type, as operation parameters.

  8. Do not accept or return ADO.NET DataSet and DataTable (or their type-safe subclasses) from operations. Return a natural representation such as an array.

  9. Suppress the generation of a generic type parameter hash code and provide a legible type name instead.

  10. Avoid the /ct switch of SvcUtil or any other way of sharing an assembly type across the service boundary.




Programming WCF Services
Programming WCF Services
ISBN: 0596526997
EAN: 2147483647
Year: 2004
Pages: 148
Authors: Juval Lowy

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net