@@ -87,10 +87,11 @@ protected void SetListChildResults(FieldDefinition fieldDef, Type refType, IList
87
87
}
88
88
}
89
89
90
- protected string GetRefSelfSql ( FieldDefinition refSelf , ModelDefinition refModelDef )
90
+ protected string GetRefSelfSql ( ModelDefinition modelDef , FieldDefinition refSelf , ModelDefinition refModelDef )
91
91
{
92
92
//Load Self Table.RefTableId PK
93
- expr . Select ( dialectProvider . GetQuotedColumnName ( refModelDef , refSelf ) ) ;
93
+ expr . Select ( dialectProvider . GetQuotedColumnName ( modelDef , refSelf ) ) ;
94
+
94
95
var subSqlRef = expr . ToSelectStatement ( ) ;
95
96
96
97
var sqlRef = "SELECT {0} FROM {1} WHERE {2} IN ({3})" . Fmt (
@@ -182,7 +183,7 @@ public void SetRefField(FieldDefinition fieldDef, Type refType)
182
183
183
184
if ( refSelf != null )
184
185
{
185
- var sqlRef = GetRefSelfSql ( refSelf , refModelDef ) ;
186
+ var sqlRef = GetRefSelfSql ( modelDef , refSelf , refModelDef ) ;
186
187
var childResults = dbCmd . ConvertToList ( refType , sqlRef ) ;
187
188
SetRefSelfChildResults ( fieldDef , refModelDef , refSelf , childResults ) ;
188
189
}
@@ -229,7 +230,7 @@ public async Task SetRefFieldAsync(FieldDefinition fieldDef, Type refType, Cance
229
230
}
230
231
else if ( refSelf != null )
231
232
{
232
- var sqlRef = GetRefSelfSql ( refSelf , refModelDef ) ;
233
+ var sqlRef = GetRefSelfSql ( modelDef , refSelf , refModelDef ) ;
233
234
var childResults = await dbCmd . ConvertToListAsync ( refType , sqlRef , token ) ;
234
235
SetRefSelfChildResults ( fieldDef , refModelDef , refSelf , childResults ) ;
235
236
}
0 commit comments