Skip to content

Commit 19e5fd3

Browse files
committed
- 补充 Utils.IsStrict = false 可配置支持中间表有 Id 主键;
1 parent eab47a5 commit 19e5fd3

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

FreeSql/Internal/UtilsExpressionTree.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ namespace FreeSql.Internal
2121
{
2222
public class Utils
2323
{
24+
public static bool IsStrict = true;
2425
/// <summary>
2526
/// 用于解决多实例情况下的静态集合缓存问题
2627
/// </summary>
@@ -1206,7 +1207,7 @@ void midTypeFind(TableInfo maintb, string findTypeName)
12061207
}
12071208
}
12081209
}
1209-
else if(minPkCols.Any(c => tbmid.ColumnsByCs[c.CsName].Attribute.IsPrimary == false))
1210+
else if(IsStrict && minPkCols.Any(c => tbmid.ColumnsByCs[c.CsName].Attribute.IsPrimary == false))
12101211
{
12111212
nvref.Exception = new Exception($"导航属性 {trytbTypeName}.{pnv.Name} 解析错误,中间类主键错误:{midType.Name}({string.Join(",", tbmid.Primarys.Select(a => a.CsName))}) 与两边不匹配");
12121213
trytb.AddOrUpdateTableRef(pnv.Name, nvref);

0 commit comments

Comments
 (0)