更改TransactedReceiveScope活动中的事务隔离级别

时间:2012-02-21 11:29:09

标签: workflow-foundation appfabric

由于我们在数据库中存在锁定问题,因此我们希望将TransactedReceiveScope隔离级别从Serializable更改为ReadCommitted。我们使用ServiceBehavior扩展程序完成了此操作:

 public class ReadCommittedServiceBehaviour : BehaviorExtensionElement ,IServiceBehavior
{

        public void AddBindingParameters(ServiceDescription serviceDescription, ServiceHostBase serviceHostBase, Collection<ServiceEndpoint> endpoints, BindingParameterCollection bindingParameters) { }
        public void ApplyDispatchBehavior(ServiceDescription serviceDescription, ServiceHostBase serviceHostBase)
        {
            serviceDescription.Behaviors.Add(new ServiceBehaviorAttribute() { TransactionIsolationLevel = IsolationLevel.ReadCommitted });
        }
        public void Validate(ServiceDescription serviceDescription, ServiceHostBase serviceHostBase) {}
        public override Type BehaviorType
        {
            get { return typeof(ReadCommittedServiceBehaviour); }
        }

        protected override object CreateBehavior()
        {
            return new ReadCommittedServiceBehaviour();
        }
}

我想知道的是......在AppFabric级别这是一个好主意吗?我担心持久性数据库中的实例创建。

由于

0 个答案:

没有答案