由于我们在数据库中存在锁定问题,因此我们希望将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级别这是一个好主意吗?我担心持久性数据库中的实例创建。
由于