Comments (2)
ISqlQuery并不是单例的,不能把它配置为单例来用。
设计SqlQuery的动机是用来配合EF解决复杂查询的问题,默认情况下,会将EF Core的DbContext注入到SqlQuery中,用来提供数据库连接和元数据映射,所以不能配置成单例,当然SqlQuery并不是跟EF Core完全耦合的,在不使用EF的情况下同样可以使用,只需要实现几个接口即可。
所以不必担心多线程场景的问题,多个线程访问的是多个类实例,不会互相影响。
如果确实碰到多个线程操作同一个SqlQuery实例的情况,也是有办法解决,虽然没有提供NewQuery方法,但有一个Clone,用来复制当前SqlQuery实例。
最后,SqlQuery实例在一个方法执行完会自动清理之前的状态,在另一个方法中执行是没有问题的,在必要的时候通过Clone来复制当前SqlQuery实例。
希望对你有帮助。
from util.
了解了。
准备单独出来使用,增加New接口。
感谢。
from util.
Related Issues (20)
- 项目还有在维护吗 HOT 2
- 6.0类缺失 HOT 1
- Angular相关问题 HOT 2
- “ServiceRegistrarConfig”未包含“DisableLocalEventBusServiceRegistrar” HOT 1
- 目标计算机积极拒绝,无法连接 HOT 1
- .net core 3.0 preview 5+ autofac support HOT 4
- 继承CrudServiceBase使用update方法,会更新创建人和创建时间为null HOT 4
- Web.GetParam("aaa") HOT 2
- partial class 建议 HOT 4
- 左边菜单显示不出来 HOT 1
- 报 Cannot find module './wwwroot/dist/util-manifest.json' 通常是因为哪个包没有还原好? HOT 4
- 如何使用CodeGenerator项目自动生成代码? HOT 1
- Util这个项目现在有权限管理的功能或模块吗? HOT 1
- How to scaffold new entities/features into your framework
- DateTime extension method ToChineseDateString couldn't need use string.appendformat
- 发现Util.Datas.Ef.Core.StoreBase类add/update/delete等方法都没有commit操作,导致提交失败
- 框架能否出一个框架设计说明文档同步更新? HOT 2
- 求更 HOT 1
- Could not load type 'Microsoft.AspNetCore.Http.Internal.BufferingHelper' from assembly HOT 1
- 09-Utili.webs 缺少包的引用
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from util.