本文介绍了在Spring.Net中使用Transaction属性时,如何覆盖默认隔离级别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在方法上使用Transaction()属性时,默认隔离级别为ReadCommitted.我想做的是在Spring.NET配置中将默认隔离级别设置为ReadUncommitted(以免修改当前存在的所有Transaction属性定义)

When using the Transaction() attribute on a method the default isolation level is ReadCommitted. What I want to do is set the default isolation level to ReadUncommitted in the Spring.NET config ( so as not to modify all the Transaction attribute definitions that exist currently)

我该怎么做?可以使用Spring.NET 1.2完成吗?

How do I do it ? Can it be done with Spring.NET 1.2 ?

我尝试遵循使用tx:advice等文档无效.

我什至使用Reflector进入了Spring的代码,但据我看来,Spring只是从方法的Attribute声明中读取设置.

I've even stepped in to the code of Spring with Reflector but all I seem to understand from that, is that Spring simply reads the settings from the Attribute declaration on the method.

可以做到吗,还是我必须遍历代码并在必要时修改属性?

Can it be done or am I going to have to go through the code and modify the attribute where necessary?

推荐答案

您应该能够创建自己的事务拦截器,以扩展标准事务拦截器.然后使用ObjectNameAutoProxyCreator而不是您引用的TransactionProxyFactoryObject来连接该对象.

You should be able to create your own transaction interceptor that extends the standard transaction interceptor. And then hook up that one using ObjectNameAutoProxyCreator instead of the TransactionProxyFactoryObject that you referenced.

这篇关于在Spring.Net中使用Transaction属性时,如何覆盖默认隔离级别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 06:52