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)

  • 相关阅读:
    两种类型插件系统
    ArcEngine序列化IFeatureRenderer对象
    [WorldWind学习]14.ConfigurationLoader类
    [WorldWind学习]15.模型加载
    AE应用程序开发的思考
    [C++摘抄]void*
    XML文件读写学习
    EA正向工程
    Word2010利用公式编辑器实现公式“显示”“居中”公式编号右对齐
    [Qt]Hello Qt !
  • 原文地址:https://www.cnblogs.com/Winston/p/1346498.html
Copyright © 2011-2022 走看看