今天整理的內容是WCF事務和並發管理相關的設計規範。WCF服務編程設計規範(5):事務與並發管理設計。中英文對照,How to design Transactions and Concurrency Management in WCF Service.
下面一節是佇列服務與安全。
Transactions
事務
1. Never manage transactions directly.
不要直接管理事務
2. Apply the TransactionFlow attribute on the contract, not the service class.
在契約而不是服務類上標註TransactionFlow屬性,
3. Do not perform transactional work in the service constructor.
不要在服務的建構函式裡執行事務操作
4. Using this book’s terminology, configure services for either Client or Client/Service transactions. Avoid None or Service transactions.
使用本書中的術語,為用戶端或用戶端/服務端事務模式佈建服務。避免使用None或服務事務模式。
5. Using this book’s terminology, configure callbacks for either Service or Service/Callback transactions. Avoid None or Callback transactions.
使用本書中的術語,為服務或服務/回調事務模式配置回調。避免使用None或回調事務模式。
6. When using the Client/Service or Service/Callback mode, constrain the binding to flow transactions using the BindingRequirement attribute.
當使用用戶端/服務或服務/回調模式,通過BindingRequirement屬性約束綁定傳播事務
7. On the client, always catch all exceptions thrown by a service configured for None or Service transactions.
在用戶端,始終捕獲None或服務事務裡拋出的所有異常。
8. Enable reliability and ordered delivery even when using transactions.
即使使用事務的時候,也要啟用可靠性和順序傳遞