• [织梦吧]唯一域名:www.dedecms8.com,织梦DedeCMS学习平台.

当前位置: > 编程与数据库 > net编程 >

WCF服务编程设计规范(3):服务契约、数据契约和实例管理设计规范(2)

来源: www.dedecms8.com 编辑:织梦吧 时间:2012-06-27点击:

5.Strive to have three to five members per service contract.

每个契约里尽量保证3-5个成员

6.Do not have more than 20 members per service contract.Twelve is probably the practical limit.

每个服务契约里成员不要超过20个。12个也许久应该就是极限

Data Contracts

数据契约

1.Avoid inferred data contracts (POCO).Always be explicit and apply the DataContract attribute.

避免使用推测性的数据契约。明确使用DataContract属性定义数据契约。

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

只在属性或者只读的成员上使用DataMember属性

2.Avoid explicit XML serialization on your own types.

自己的类型上明确使用XML序列化标记

3.Avoid message contracts.

避免使用消息契约

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

当使用Order属性的时候,对于类层次相同的所有成员赋相同的值

6.Support IExtensibleDataObject on your data contracts.Use explicit interface implementation.

数据契约支持IExtensibleDataObject。使用明确地实现接口。

 

7.Avoid setting IgnoreExtensionDataObject to true in the ServiceBehavior and CallbackBehavior attributes.Keep the default of false.

避免在ServiceBehavior和CallbackBehavior属性里把IgnoreExtensionDataObject 设置为true。保持默认的false

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

不要使用委托和事件作为数据成员

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

不要传递.NET-specific类型,比如Type,作为操作参数。

10.Do not accept or return ADO.NET DataSets and DataTables (or their type-safe subclasses) from operations.Return a neutral representation such as an array.

About D8

  • ©2014 织梦吧(d8) DedeCMS学习交流平台
  • 唯一网址 www.DedeCMS8.com 网站地图
  • 联系我们 1170734538@qq.com ,  QQ