mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-11-08 02:14:53 +08:00
Navigate query support custom
This commit is contained in:
@@ -294,7 +294,11 @@ namespace SqlSugar
|
||||
var navEntityInfo = this.Context.EntityMaintenance.GetEntityInfo(navType);
|
||||
this.Context.InitMappingInfo(navEntityInfo.Type);
|
||||
var navPkColumn = navEntityInfo.Columns.Where(it => it.IsPrimarykey).FirstOrDefault();
|
||||
Check.ExceptionEasy(navPkColumn==null, navEntityInfo.EntityName+ "need primarykey", navEntityInfo.EntityName + " 需要主键");
|
||||
Check.ExceptionEasy(navPkColumn==null&& navObjectNameColumnInfo.Navigat.Name2==null, navEntityInfo.EntityName+ "need primarykey", navEntityInfo.EntityName + " 需要主键");
|
||||
if (navPkColumn==null)
|
||||
{
|
||||
navPkColumn = navEntityInfo.Columns.Where(it => it.PropertyName== navObjectNameColumnInfo.Navigat.Name2).FirstOrDefault();
|
||||
}
|
||||
var ids = list.Select(it => it.GetType().GetProperty(navObjectNameColumnInfo.Navigat.Name).GetValue(it)).Select(it => it == null ? "null" : it).Distinct().ToList();
|
||||
List<IConditionalModel> conditionalModels = new List<IConditionalModel>();
|
||||
conditionalModels.Add((new ConditionalModel()
|
||||
|
||||
@@ -215,6 +215,7 @@ namespace SqlSugar
|
||||
public class Navigate: Attribute
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string Name2 { get; set; }
|
||||
public Type MappingType { get; set; }
|
||||
public string MappingAId { get; set; }
|
||||
public string MappingBId { get; set; }
|
||||
@@ -224,6 +225,12 @@ namespace SqlSugar
|
||||
this.Name = name;
|
||||
this.NavigatType = navigatType;
|
||||
}
|
||||
public Navigate(NavigateType navigatType, string firstName,string lastName)
|
||||
{
|
||||
this.Name = firstName;
|
||||
this.Name2 = lastName;
|
||||
this.NavigatType = navigatType;
|
||||
}
|
||||
public Navigate(Type MappingTableType,string typeAiD,string typeBId)
|
||||
{
|
||||
this.MappingType = MappingTableType;
|
||||
|
||||
Reference in New Issue
Block a user