WCF服务编程设计规范(3):服务契约、数据契约和实例管理设计规范2012-02-23 博客园 Frank Xu LeiWCF服务编程设计规范(3):服务契约、数据契约和实例管理设计规范。本节涵盖服务契约和数据契约设计规范,以及服务实例管理内容。中英对照版本,欢迎留言交流。Service Contracts服务契约1.Always apply the ServiceContract attribute on an interface, not a class:把ServiceContract属性标记到契约接口上,而不是服务类上//Avoid:避免 [ServiceContract] class MyService { [OperationContract] public void MyMethod() {...} } //Correct:正确 [ServiceContract] interface IMyContract { [OperationContract] void MyMethod(); } class MyService : IMyContract { public void MyMethod() {...} }2.Prefix the service contract name with an I:服务契约名称以I开头[ServiceContract] interface IMyContract {...}