Giter Site home page Giter Site logo

Comments (2)

UtilCore avatar UtilCore commented on August 28, 2024 1

ISqlQuery并不是单例的,不能把它配置为单例来用。
设计SqlQuery的动机是用来配合EF解决复杂查询的问题,默认情况下,会将EF Core的DbContext注入到SqlQuery中,用来提供数据库连接和元数据映射,所以不能配置成单例,当然SqlQuery并不是跟EF Core完全耦合的,在不使用EF的情况下同样可以使用,只需要实现几个接口即可。
所以不必担心多线程场景的问题,多个线程访问的是多个类实例,不会互相影响。
如果确实碰到多个线程操作同一个SqlQuery实例的情况,也是有办法解决,虽然没有提供NewQuery方法,但有一个Clone,用来复制当前SqlQuery实例。
最后,SqlQuery实例在一个方法执行完会自动清理之前的状态,在另一个方法中执行是没有问题的,在必要的时候通过Clone来复制当前SqlQuery实例。
希望对你有帮助。

from util.

kaanid avatar kaanid commented on August 28, 2024

了解了。
准备单独出来使用,增加New接口。
感谢。

from util.

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.