zoukankan      html  css  js  c++  java
  • WCF中各种Transaction的分类及其相关参数的设置

    前言:

    在WCF中实现多事务协调,需要多方面的协调。既涉及到binding协议的设置,又涉及到ServiceBehavior和OperationBehavior的设置。

    我们知道,关于binging protocal涉及到transaction的有2个值,即TransactionFlow=true|false。在ServiceBehavior-level,涉及到Transaction的是TransactionFlowOption,其值有Allowed,NotAllowed,Mandatory共3个option。在OperationBehavior-level,涉及到Transaction的是TransactionScopeRequired,其值有True|false共2个。 因此,将其全部组合起来的话,产生的可能配置为2*3*2=12种。

    用一个简单的公式表示为:

    Transaction = TransactionFlow[True|false](binding protocal)  
                        +TransactionFlowOption[Allowed|NotAllowed|Mandatory](ServiceBehavior) 
                        +TransactionScopeRequired[True|false](OperationBehavior)

    实际上,在这12种可能的配置中,有4种是相互矛盾的,因此剩下8种可能的配置。 My god,要配置一个事务还有8种可能的配置 :(

     正文:

    为了便于记忆,我们将剩余8种可能的配置分为4类,分别为:客户/服务型事务(client/service transaction),客户型事务(client transaction),服务型事务,非事务。

    下面给出每种WCF中事务类型的典型配置

    1.客户/服务型事务

     TransactionFlow=true(binding) + TransactionFlowOption=Allowed(ServiceBehavior) + TransactionScopeRequired=true(OperationBevior)

    2.客户型事务

     TransactionFlow=true(binding) + TransactionFlowOption=Mandatory(ServiceBehavior) + TransactionScopeRequired=true(OperationBevior)

    3 服务型事务

     TransactionFlow=false(binding) + TransactionFlowOption=NotAllowed(ServiceBehavior) + TransactionScopeRequired=true(OperationBevior)

    4 非事务

     TransactionFlow=false(binding) + TransactionFlowOption=NotAllowed(ServiceBehavior) + TransactionScopeRequired=false(OperationBevior) (简单的讲,如果发布一个service,不做任何Transaction方面的设置,该Service就是nontransactional)

  • 相关阅读:
    微服务划分的姿势
    微服务的时间和成本去哪儿了
    假如你是架构师,你要做些什么
    说透代码评审
    从哲学层面浅谈计算机学习方法论
    分布式事务:两阶段提交与三阶段提交
    敏捷史话(四):敏捷是人的天性 —— Arie van Bennekum
    敏捷史话(三):笃定前行的勇者——Ken Schwaber
    敏捷史话(二):Scrum社区的悲剧性损失——Mike Beedle
    敏捷史话(一):用一半的时间做两倍的事——Scrum之父Jeff Sutherland
  • 原文地址:https://www.cnblogs.com/Winston/p/1346498.html
Copyright © 2011-2022 走看看