mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-06-18 20:08:15 +08:00
## v0.3.27
- 增加 行级锁功能,适用修改实体; - 增加 FreeSql.Repository 默认依赖注入的方式,同时保留原有 Autofac; - 优化 FreeSql.Repository Insert 逻辑,参考了 FreeSql.DbContext; - 优化 FreeSql.IUpdate 参照 IInsert 对大批量更新,拆分执行; - 修复 FreeSql.IInsert ClearData 重复利用的 bug(使用 IgnoreColumns 进行大批量插入时会发生);
This commit is contained in:
@ -42,8 +42,15 @@ namespace FreeSql {
|
||||
|
||||
}
|
||||
|
||||
|
||||
Dictionary<Type, object> _dicSet = new Dictionary<Type, object>();
|
||||
public DbSet<TEntity> Set<TEntity>() where TEntity : class => this.Set(typeof(TEntity)) as DbSet<TEntity>;
|
||||
public object Set(Type entityType) => Activator.CreateInstance(typeof(BaseDbSet<>).MakeGenericType(entityType), this);
|
||||
public object Set(Type entityType) {
|
||||
if (_dicSet.ContainsKey(entityType)) return _dicSet[entityType];
|
||||
var sd = Activator.CreateInstance(typeof(BaseDbSet<>).MakeGenericType(entityType), this);
|
||||
_dicSet.Add(entityType, sd);
|
||||
return sd;
|
||||
}
|
||||
|
||||
protected Dictionary<string, object> AllSets { get; } = new Dictionary<string, object>();
|
||||
|
||||
@ -92,6 +99,7 @@ namespace FreeSql {
|
||||
}
|
||||
}
|
||||
void Rollback() {
|
||||
_actions.Clear();
|
||||
if (_tran != null) {
|
||||
try {
|
||||
_tran.Rollback();
|
||||
|
Reference in New Issue
Block a user