mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-04-22 02:32:50 +08:00
- 增加 InsertDict ExecuteIdentity 重载指定自增列;
This commit is contained in:
parent
f83331c8f6
commit
52bc16d7c9
@ -15,6 +15,7 @@ using System.Drawing;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Linq.Expressions;
|
using System.Linq.Expressions;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using System.Security.Principal;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@ -1069,7 +1070,13 @@ SELECT ");
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int ExecuteAffrows() => _insertProvider.ExecuteAffrows();
|
public int ExecuteAffrows() => _insertProvider.ExecuteAffrows();
|
||||||
public long ExecuteIdentity() => _insertProvider.ExecuteIdentity();
|
public long ExecuteIdentity(string identityColumn = null)
|
||||||
|
{
|
||||||
|
if (_insertProvider._table.ColumnsByCs.TryGetValue(identityColumn, out var col) == false)
|
||||||
|
throw new Exception(CoreStrings.GetPrimarys_ParameterError_IsNotDictKey(identityColumn).Replace(nameof(ExecuteIdentity), ""));
|
||||||
|
col.Attribute.IsIdentity = true;
|
||||||
|
return _insertProvider.ExecuteIdentity();
|
||||||
|
}
|
||||||
public List<Dictionary<string, object>> ExecuteInserted() => _insertProvider.ExecuteInserted();
|
public List<Dictionary<string, object>> ExecuteInserted() => _insertProvider.ExecuteInserted();
|
||||||
|
|
||||||
#if net40
|
#if net40
|
||||||
|
@ -251,7 +251,7 @@ namespace FreeSql.Xugu
|
|||||||
{
|
{
|
||||||
case "Now": return _common.Now;
|
case "Now": return _common.Now;
|
||||||
case "UtcNow": return _common.NowUtc;
|
case "UtcNow": return _common.NowUtc;
|
||||||
case "Today": return "convert(char(10),getdate(),120)";
|
case "Today": return $"cast(date_format({_common.Now},'%Y-%m-%d') as datetime)";
|
||||||
case "MinValue": return "'1753/1/1 0:00:00'";
|
case "MinValue": return "'1753/1/1 0:00:00'";
|
||||||
case "MaxValue": return "'9999/12/31 23:59:59'";
|
case "MaxValue": return "'9999/12/31 23:59:59'";
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user