mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-04-22 18:52:50 +08:00
update internal code
This commit is contained in:
parent
fd7d627603
commit
45f06c3025
@ -257,15 +257,15 @@ new Colorful.Formatter("推荐在实体类目录创建 gen.bat,双击它重新
|
||||
RazorEngine.Engine.Razor.Run(razorId, sw, null, model);
|
||||
|
||||
StringBuilder plus = new StringBuilder();
|
||||
plus.AppendLine("//------------------------------------------------------------------------------");
|
||||
plus.AppendLine("// <auto-generated>");
|
||||
plus.AppendLine("// 此代码由工具 FreeSql.Generator 生成。");
|
||||
plus.AppendLine("// 运行时版本:" + Environment.Version.ToString());
|
||||
plus.AppendLine("// Website: https://github.com/2881099/FreeSql");
|
||||
plus.AppendLine("// 对此文件的更改可能会导致不正确的行为,并且如果");
|
||||
plus.AppendLine("// 重新生成代码,这些更改将会丢失。");
|
||||
plus.AppendLine("// </auto-generated>");
|
||||
plus.AppendLine("//------------------------------------------------------------------------------");
|
||||
//plus.AppendLine("//------------------------------------------------------------------------------");
|
||||
//plus.AppendLine("// <auto-generated>");
|
||||
//plus.AppendLine("// 此代码由工具 FreeSql.Generator 生成。");
|
||||
//plus.AppendLine("// 运行时版本:" + Environment.Version.ToString());
|
||||
//plus.AppendLine("// Website: https://github.com/2881099/FreeSql");
|
||||
//plus.AppendLine("// 对此文件的更改可能会导致不正确的行为,并且如果");
|
||||
//plus.AppendLine("// 重新生成代码,这些更改将会丢失。");
|
||||
//plus.AppendLine("// </auto-generated>");
|
||||
//plus.AppendLine("//------------------------------------------------------------------------------");
|
||||
plus.Append(sw.ToString());
|
||||
plus.AppendLine();
|
||||
|
||||
|
@ -50,6 +50,7 @@ switch (gen.fsql.Ado.DataType) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
namespace @gen.NameSpace {
|
||||
|
||||
@if (string.IsNullOrEmpty(gen.table.Comment) == false) {
|
||||
@ -133,6 +134,7 @@ switch (gen.fsql.Ado.DataType) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
namespace @gen.NameSpace {
|
||||
|
||||
@if (string.IsNullOrEmpty(gen.table.Comment) == false) {
|
||||
|
@ -37,7 +37,7 @@ namespace FreeSql
|
||||
{
|
||||
var db = _resolveDbContext?.Invoke();
|
||||
db?.FlushCommand();
|
||||
var select = _originalFsql.Select<T1>().WithTransaction(_resolveUnitOfWork()?.GetOrBeginTransaction(false));
|
||||
var select = _originalFsql.Select<T1>().WithTransaction(_resolveUnitOfWork?.Invoke()?.GetOrBeginTransaction(false));
|
||||
if (db?.Options.EnableGlobalFilter == false) select.DisableGlobalFilter();
|
||||
return select;
|
||||
}
|
||||
@ -47,7 +47,7 @@ namespace FreeSql
|
||||
{
|
||||
var db = _resolveDbContext?.Invoke();
|
||||
db?.FlushCommand();
|
||||
var delete = _originalFsql.Delete<T1>().WithTransaction(_resolveUnitOfWork()?.GetOrBeginTransaction());
|
||||
var delete = _originalFsql.Delete<T1>().WithTransaction(_resolveUnitOfWork?.Invoke()?.GetOrBeginTransaction());
|
||||
if (db?.Options.EnableGlobalFilter == false) delete.DisableGlobalFilter();
|
||||
return delete;
|
||||
}
|
||||
@ -57,7 +57,7 @@ namespace FreeSql
|
||||
{
|
||||
var db = _resolveDbContext?.Invoke();
|
||||
db?.FlushCommand();
|
||||
var update = _originalFsql.Update<T1>().WithTransaction(_resolveUnitOfWork()?.GetOrBeginTransaction());
|
||||
var update = _originalFsql.Update<T1>().WithTransaction(_resolveUnitOfWork?.Invoke()?.GetOrBeginTransaction());
|
||||
if (db?.Options.NoneParameter != null) update.NoneParameter(db.Options.NoneParameter.Value);
|
||||
if (db?.Options.EnableGlobalFilter == false) update.DisableGlobalFilter();
|
||||
return update;
|
||||
@ -68,7 +68,7 @@ namespace FreeSql
|
||||
{
|
||||
var db = _resolveDbContext?.Invoke();
|
||||
db?.FlushCommand();
|
||||
var insert = _originalFsql.Insert<T1>().WithTransaction(_resolveUnitOfWork()?.GetOrBeginTransaction());
|
||||
var insert = _originalFsql.Insert<T1>().WithTransaction(_resolveUnitOfWork?.Invoke()?.GetOrBeginTransaction());
|
||||
if (db?.Options.NoneParameter != null) insert.NoneParameter(db.Options.NoneParameter.Value);
|
||||
return insert;
|
||||
}
|
||||
@ -76,11 +76,12 @@ namespace FreeSql
|
||||
public IInsert<T1> Insert<T1>(T1[] source) where T1 : class => Insert<T1>().AppendData(source);
|
||||
public IInsert<T1> Insert<T1>(List<T1> source) where T1 : class => Insert<T1>().AppendData(source);
|
||||
public IInsert<T1> Insert<T1>(IEnumerable<T1> source) where T1 : class => Insert<T1>().AppendData(source);
|
||||
|
||||
public IInsertOrUpdate<T1> InsertOrUpdate<T1>() where T1 : class
|
||||
{
|
||||
var db = _resolveDbContext?.Invoke();
|
||||
db?.FlushCommand();
|
||||
return _originalFsql.InsertOrUpdate<T1>().WithTransaction(_resolveUnitOfWork()?.GetOrBeginTransaction());
|
||||
return _originalFsql.InsertOrUpdate<T1>().WithTransaction(_resolveUnitOfWork?.Invoke()?.GetOrBeginTransaction());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -52,6 +52,7 @@ public interface IFreeSql : IDisposable
|
||||
/// Oracle: merge into<para></para>
|
||||
/// Sqlite: replace into<para></para>
|
||||
/// Dameng: merge into<para></para>
|
||||
/// 注意:还可以使用 FreeSql.Repository 的 InsertOrUpdate 方法
|
||||
/// </summary>
|
||||
/// <typeparam name="T1"></typeparam>
|
||||
/// <returns></returns>
|
||||
|
Loading…
x
Reference in New Issue
Block a user