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各种类型及设置方法介绍
网页链接:http://www.hantingmc.com/qtweb/news0/250.html

网站建设、网络推广公司-创新互联,是专注品牌与效果的网站制作,网络营销seo公司;服务项目有等

广告

声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联