- 优化 表达式 true && ... 解析的处理;

- 优化 Navigate 指定联合键关系时,对属性顺序的要求,当类型不一样、名称一样时无须指明属性的顺序,如:[Navigate("MemberId, ShopId")];
This commit is contained in:
28810
2019-07-04 19:46:51 +08:00
parent 619c57c254
commit 3ebc01f88d
16 changed files with 265 additions and 42 deletions

View File

@@ -568,6 +568,19 @@ namespace FreeSql.Internal
trytb.AddOrUpdateTableRef(pnv.Name, nvref);
//if (isLazy) throw nvref.Exception;
}
if (trytb.Primarys.Length > 1)
{
if (trytb.Primarys.Select(a => a.CsType).Distinct().Count() == trytb.Primarys.Length)
{
var pkList = trytb.Primarys.ToList();
bindColumns.Sort((a, b) => pkList.FindIndex(c => c.CsType == a.CsType).CompareTo(pkList.FindIndex(c => c.CsType == b.CsType)));
}
else if (string.Compare(string.Join(",", trytb.Primarys.Select(a => a.CsName).OrderBy(a => a)), string.Join(",", bindColumns.Select(a => a.CsName).OrderBy(a => a)), true) == 0)
{
var pkList = trytb.Primarys.ToList();
bindColumns.Sort((a, b) => pkList.FindIndex(c => string.Compare(c.CsName, a.CsName, true) == 0).CompareTo(pkList.FindIndex(c => string.Compare(c.CsName, b.CsName, true) == 0)));
}
}
for (var a = 0; nvref.Exception == null && a < trytb.Primarys.Length; a++)
{
var findtrytbPkCsName = trytb.Primarys[a].CsName.TrimStart('_');
@@ -705,6 +718,19 @@ namespace FreeSql.Internal
trytb.AddOrUpdateTableRef(pnv.Name, nvref);
//if (isLazy) throw nvref.Exception;
}
if (tbref.Primarys.Length > 1)
{
if (tbref.Primarys.Select(a => a.CsType).Distinct().Count() == tbref.Primarys.Length)
{
var pkList = tbref.Primarys.ToList();
bindColumns.Sort((a, b) => pkList.FindIndex(c => c.CsType == a.CsType).CompareTo(pkList.FindIndex(c => c.CsType == b.CsType)));
}
else if (string.Compare(string.Join(",", tbref.Primarys.Select(a => a.CsName).OrderBy(a => a)), string.Join(",", bindColumns.Select(a => a.CsName).OrderBy(a => a)), true) == 0)
{
var pkList = tbref.Primarys.ToList();
bindColumns.Sort((a, b) => pkList.FindIndex(c => string.Compare(c.CsName, a.CsName, true) == 0).CompareTo(pkList.FindIndex(c => string.Compare(c.CsName, b.CsName, true) == 0)));
}
}
for (var a = 0; nvref.Exception == null && a < tbref.Primarys.Length; a++)
{
var findtbrefPkCsName = tbref.Primarys[a].CsName.TrimStart('_');