mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-04-22 02:32:50 +08:00
parent
acc1754e2e
commit
e3c0f615f9
@ -43,9 +43,7 @@ namespace FreeSql.Extensions.EntityUtil {
|
|||||||
for (var a = 0; a < pks.Length; a++) {
|
for (var a = 0; a < pks.Length; a++) {
|
||||||
var isguid = pks[a].CsType.NullableTypeOrThis() == typeof(Guid);
|
var isguid = pks[a].CsType.NullableTypeOrThis() == typeof(Guid);
|
||||||
Expression expthen = null;
|
Expression expthen = null;
|
||||||
if (isguid == false)
|
if (isguid) {
|
||||||
expthen = Expression.Assign(var3IsNull, Expression.Constant(true));
|
|
||||||
else {
|
|
||||||
expthen = Expression.Block(
|
expthen = Expression.Block(
|
||||||
new Expression[]{
|
new Expression[]{
|
||||||
Expression.Assign(Expression.MakeMemberAccess(var1Parm, _table.Properties[pks[a].CsName]), Expression.Call(MethodFreeUtilNewMongodbId)),
|
Expression.Assign(Expression.MakeMemberAccess(var1Parm, _table.Properties[pks[a].CsName]), Expression.Call(MethodFreeUtilNewMongodbId)),
|
||||||
@ -55,6 +53,17 @@ namespace FreeSql.Extensions.EntityUtil {
|
|||||||
)
|
)
|
||||||
}.Where(c => c != null).ToArray()
|
}.Where(c => c != null).ToArray()
|
||||||
);
|
);
|
||||||
|
} else if (pks.Length > 1 && pks[a].Attribute.IsIdentity) {
|
||||||
|
expthen = Expression.Block(
|
||||||
|
new Expression[]{
|
||||||
|
a > 0 ? Expression.Call(var2Sb, MethodStringBuilderAppend, Expression.Constant(splitString)) : null,
|
||||||
|
Expression.Call(var2Sb, MethodStringBuilderAppend,
|
||||||
|
Expression.Convert(Expression.MakeMemberAccess(var1Parm, _table.Properties[pks[a].CsName]), typeof(object))
|
||||||
|
)
|
||||||
|
}.Where(c => c != null).ToArray()
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
expthen = Expression.Assign(var3IsNull, Expression.Constant(true));
|
||||||
}
|
}
|
||||||
if (pks[a].Attribute.IsIdentity || isguid || pks[a].CsType == typeof(string) || pks[a].CsType.IsNullableType()) {
|
if (pks[a].Attribute.IsIdentity || isguid || pks[a].CsType == typeof(string) || pks[a].CsType.IsNullableType()) {
|
||||||
exps.Add(
|
exps.Add(
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netstandard2.0</TargetFramework>
|
<TargetFramework>netstandard2.0</TargetFramework>
|
||||||
<Version>0.5.1.3</Version>
|
<Version>0.5.2</Version>
|
||||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||||
<Authors>YeXiangQin</Authors>
|
<Authors>YeXiangQin</Authors>
|
||||||
<Description>FreeSql is the most convenient ORM in dotnet. It supports Mysql, Postgresql, SqlServer, Oracle and Sqlite.</Description>
|
<Description>FreeSql is the most convenient ORM in dotnet. It supports Mysql, Postgresql, SqlServer, Oracle and Sqlite.</Description>
|
||||||
|
@ -323,6 +323,8 @@ namespace FreeSql.Internal.CommonProvider {
|
|||||||
isclose = true;
|
isclose = true;
|
||||||
}
|
}
|
||||||
cmd.Connection = connection;
|
cmd.Connection = connection;
|
||||||
|
if (transaction.Connection == connection)
|
||||||
|
cmd.Transaction = transaction;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsTracePerformance) dt = DateTime.Now;
|
if (IsTracePerformance) dt = DateTime.Now;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user