@@ -43,9 +43,7 @@ public static string GetEntityKeyString(this IFreeSql orm, Type entityType, obje
43
43
for ( var a = 0 ; a < pks . Length ; a ++ ) {
44
44
var isguid = pks [ a ] . CsType . NullableTypeOrThis ( ) == typeof ( Guid ) ;
45
45
Expression expthen = null ;
46
- if ( isguid == false )
47
- expthen = Expression . Assign ( var3IsNull , Expression . Constant ( true ) ) ;
48
- else {
46
+ if ( isguid ) {
49
47
expthen = Expression . Block (
50
48
new Expression [ ] {
51
49
Expression . Assign ( Expression . MakeMemberAccess ( var1Parm , _table . Properties [ pks [ a ] . CsName ] ) , Expression . Call ( MethodFreeUtilNewMongodbId ) ) ,
@@ -55,6 +53,17 @@ public static string GetEntityKeyString(this IFreeSql orm, Type entityType, obje
55
53
)
56
54
} . Where ( c => c != null ) . ToArray ( )
57
55
) ;
56
+ } else if ( pks . Length > 1 && pks [ a ] . Attribute . IsIdentity ) {
57
+ expthen = Expression . Block (
58
+ new Expression [ ] {
59
+ a > 0 ? Expression . Call ( var2Sb , MethodStringBuilderAppend , Expression . Constant ( splitString ) ) : null ,
60
+ Expression . Call ( var2Sb , MethodStringBuilderAppend ,
61
+ Expression . Convert ( Expression . MakeMemberAccess ( var1Parm , _table . Properties [ pks [ a ] . CsName ] ) , typeof ( object ) )
62
+ )
63
+ } . Where ( c => c != null ) . ToArray ( )
64
+ ) ;
65
+ } else {
66
+ expthen = Expression . Assign ( var3IsNull , Expression . Constant ( true ) ) ;
58
67
}
59
68
if ( pks [ a ] . Attribute . IsIdentity || isguid || pks [ a ] . CsType == typeof ( string ) || pks [ a ] . CsType . IsNullableType ( ) ) {
60
69
exps . Add (
0 commit comments