mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-04-22 10:42:52 +08:00
- 修复 InsertDict/UpdateDict 等字典操作在 DbContext.Orm 下无法使用的 bug;#1064
This commit is contained in:
parent
36d648c64b
commit
af4b8284e0
@ -771,8 +771,7 @@ SELECT ");
|
||||
internal readonly InsertProvider<Dictionary<string, object>> _insertProvider;
|
||||
internal InsertDictImpl(IFreeSql orm)
|
||||
{
|
||||
_insertProvider = (orm as BaseDbProvider ?? throw new Exception("IFreeSql 无法转换成 BaseDbProvider"))
|
||||
.CreateInsertProvider<Dictionary<string, object>>() as InsertProvider<Dictionary<string, object>>;
|
||||
_insertProvider = orm.Insert<Dictionary<string, object>>() as InsertProvider<Dictionary<string, object>>;
|
||||
}
|
||||
|
||||
public InsertDictImpl AsTable(string tableName)
|
||||
@ -837,8 +836,7 @@ SELECT ");
|
||||
internal readonly UpdateProvider<Dictionary<string, object>> _updateProvider;
|
||||
internal UpdateDictImpl(IFreeSql orm)
|
||||
{
|
||||
_updateProvider = (orm as BaseDbProvider ?? throw new Exception("IFreeSql 无法转换成 BaseDbProvider"))
|
||||
.CreateUpdateProvider<Dictionary<string, object>>(null) as UpdateProvider<Dictionary<string, object>>;
|
||||
_updateProvider = orm.Update<Dictionary<string, object>>(null) as UpdateProvider<Dictionary<string, object>>;
|
||||
}
|
||||
|
||||
public UpdateDictImpl WherePrimary(params string[] primarys)
|
||||
@ -926,8 +924,7 @@ SELECT ");
|
||||
internal readonly InsertOrUpdateProvider<Dictionary<string, object>> _insertOrUpdateProvider;
|
||||
internal InsertOrUpdateDictImpl(IFreeSql orm)
|
||||
{
|
||||
_insertOrUpdateProvider = (orm as BaseDbProvider ?? throw new Exception("IFreeSql 无法转换成 BaseDbProvider"))
|
||||
.CreateInsertOrUpdateProvider<Dictionary<string, object>>() as InsertOrUpdateProvider<Dictionary<string, object>>;
|
||||
_insertOrUpdateProvider = orm.InsertOrUpdate<Dictionary<string, object>>() as InsertOrUpdateProvider<Dictionary<string, object>>;
|
||||
}
|
||||
|
||||
public InsertOrUpdateDictImpl WherePrimary(params string[] primarys)
|
||||
@ -980,8 +977,7 @@ SELECT ");
|
||||
internal readonly DeleteProvider<Dictionary<string, object>> _deleteProvider;
|
||||
internal DeleteDictImpl(IFreeSql orm)
|
||||
{
|
||||
_deleteProvider = (orm as BaseDbProvider ?? throw new Exception("IFreeSql 无法转换成 BaseDbProvider"))
|
||||
.CreateDeleteProvider<Dictionary<string, object>>(null) as DeleteProvider<Dictionary<string, object>>;
|
||||
_deleteProvider = orm.Delete<Dictionary<string, object>>(null) as DeleteProvider<Dictionary<string, object>>;
|
||||
}
|
||||
|
||||
public DeleteDictImpl AsTable(string tableName)
|
||||
|
@ -15,15 +15,28 @@ namespace FreeSql.Internal.CommonProvider
|
||||
|
||||
public ISelect<T1> Select<T1>() where T1 : class => CreateSelectProvider<T1>(null);
|
||||
public ISelect<T1> Select<T1>(object dywhere) where T1 : class => CreateSelectProvider<T1>(dywhere);
|
||||
public IInsert<T1> Insert<T1>() where T1 : class
|
||||
public IInsert<T1> Insert<T1>() where T1 : class => CreateInsertProvider<T1>();
|
||||
public IInsert<T1> Insert<T1>(T1 source) where T1 : class
|
||||
{
|
||||
if (typeof(T1) == typeof(Dictionary<string, object>)) throw new Exception("请使用 fsql.InsertDict(dict) 方法插入字典数据");
|
||||
return CreateInsertProvider<T1>();
|
||||
return this.Insert<T1>().AppendData(source);
|
||||
}
|
||||
public IInsert<T1> Insert<T1>(T1[] source) where T1 : class
|
||||
{
|
||||
if (typeof(T1) == typeof(Dictionary<string, object>)) throw new Exception("请使用 fsql.InsertDict(dict) 方法插入字典数据");
|
||||
return this.Insert<T1>().AppendData(source);
|
||||
}
|
||||
public IInsert<T1> Insert<T1>(List<T1> source) where T1 : class
|
||||
{
|
||||
|
||||
if (typeof(T1) == typeof(Dictionary<string, object>)) throw new Exception("请使用 fsql.InsertDict(dict) 方法插入字典数据");
|
||||
return this.Insert<T1>().AppendData(source);
|
||||
}
|
||||
public IInsert<T1> Insert<T1>(IEnumerable<T1> source) where T1 : class
|
||||
{
|
||||
if (typeof(T1) == typeof(Dictionary<string, object>)) throw new Exception("请使用 fsql.InsertDict(dict) 方法插入字典数据");
|
||||
return this.Insert<T1>().AppendData(source);
|
||||
}
|
||||
public IInsert<T1> Insert<T1>(T1 source) where T1 : class => this.Insert<T1>().AppendData(source);
|
||||
public IInsert<T1> Insert<T1>(T1[] source) where T1 : class => this.Insert<T1>().AppendData(source);
|
||||
public IInsert<T1> Insert<T1>(List<T1> source) where T1 : class => this.Insert<T1>().AppendData(source);
|
||||
public IInsert<T1> Insert<T1>(IEnumerable<T1> source) where T1 : class => this.Insert<T1>().AppendData(source);
|
||||
public IUpdate<T1> Update<T1>() where T1 : class => CreateUpdateProvider<T1>(null);
|
||||
public IUpdate<T1> Update<T1>(object dywhere) where T1 : class => CreateUpdateProvider<T1>(dywhere);
|
||||
public IDelete<T1> Delete<T1>() where T1 : class => CreateDeleteProvider<T1>(null);
|
||||
|
Loading…
x
Reference in New Issue
Block a user