成都网站建设设计

将想法与焦点和您一起共享

WCFTransaction各种类型及设置方法介绍

WCF通过其强大的功能优势,为我们实现了一个全新的跨平台的企业级互联应用平、解决方案。在WCF中实现多事务协调,需要多方面的协调。既涉及到binding协议的设置,又涉及到ServiceBehavior和OperationBehavior的设置。

创新互联是一家专业提供薛城企业网站建设,专注与成都网站制作、成都做网站、H5页面制作、小程序制作等业务。10年已为薛城众多企业、政府机构等服务。创新互联专业网站制作公司优惠进行中。

我们知道,关于binging protocal涉及到WCF 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种。

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

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

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

为了便于记忆,我们将剩余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,不做任何WCF Transaction方面的设置,该Service就是nontransactional


分享题目:WCFTransaction各种类型及设置方法介绍
当前地址:https://chengdu.cdxwcx.cn/article/dpjgepo.html