Git Product home page Git Product logo

Comments (6)

Ahoo-Wang avatar Ahoo-Wang commented on July 28, 2024 1

@Seanwong933 下个小版本将支持
image

from smartsql.

Ahoo-Wang avatar Ahoo-Wang commented on July 28, 2024
  1. 代理仓储接口从使用上应该是不需要加事务AOP注解的,因为这个是单一操作,不需要加事务。
  2. 代理仓储接口是通过SmartSql的动态代理库动态生成的实现类,而SmartSql.AOP提供的事务AOP注解是通过 AspectCore-Framework 来提供的,这就相当于 动态代理 + 动态代理。

from smartsql.

siegrainwong avatar siegrainwong commented on July 28, 2024

明白了 ,谢谢解答
不过我的Delete里有五条语句,所以才想这样操作的。
现在声明了个虚方法加上Transaction实现了。

from smartsql.

siegrainwong avatar siegrainwong commented on July 28, 2024

点赞~

from smartsql.

Ahoo-Wang avatar Ahoo-Wang commented on July 28, 2024

Ref https://github.com/dotnetcore/SmartSql/releases/tag/v4.0.29

可以通过一下几种方式开启事物:

  1. 在动态仓储接口函数上加上 UseTransaction 注解
        [UseTransaction]
        long DoByAnnotationTransaction(AllPrimitive entity);
  1. 在 Statement 加上 Transaction 属性
 <Statement Id="DoByTransaction" Transaction="Unspecified">
// do-something-0 
// do-something-1
// do-something-2 
// do-something-3 
</Statement>
  1. 在 RequestContext 传入 Transaction 属性
            var id = DbSession.ExecuteScalar<long>(new RequestContext
            {
                Scope = nameof(User),
                SqlId = "Insert",
                Transaction = IsolationLevel.Unspecified,
                Request = new User
                {
                   UserName= "SmartSql",
                }
            });

from smartsql.

siegrainwong avatar siegrainwong commented on July 28, 2024

谢谢,用上了~

from smartsql.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.