mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-11-09 10:55:02 +08:00
Same as the previous question
This commit is contained in:
@@ -27,7 +27,7 @@ namespace OrmTest
|
|||||||
db.Insertable(new UnitaStudentA() { StudentId = 6, SchoolId = 3, Name = "青鸟学生" }).ExecuteCommand();
|
db.Insertable(new UnitaStudentA() { StudentId = 6, SchoolId = 3, Name = "青鸟学生" }).ExecuteCommand();
|
||||||
|
|
||||||
var list=db.Queryable<UnitaStudentA>()
|
var list=db.Queryable<UnitaStudentA>()
|
||||||
.Includes(x => x.SchoolA).ToList();
|
.Includes(x => x.SchoolA).Where(x=>x.SchoolA.School_Name=="a").ToList();
|
||||||
}
|
}
|
||||||
public class UnitaStudentA
|
public class UnitaStudentA
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -77,7 +77,18 @@ namespace SqlSugar
|
|||||||
" NavigateType.Dynamic no support expression . "+ this.ProPertyEntity.Type.Name,
|
" NavigateType.Dynamic no support expression . "+ this.ProPertyEntity.Type.Name,
|
||||||
" NavigateType.Dynamic 自定义导航对象不支持在Where(x=>x.自定义.Id==1)等方法中使用"+ this.ProPertyEntity.Type.Name);
|
" NavigateType.Dynamic 自定义导航对象不支持在Where(x=>x.自定义.Id==1)等方法中使用"+ this.ProPertyEntity.Type.Name);
|
||||||
}
|
}
|
||||||
var pk = this.ProPertyEntity.Columns.First(it => it.IsPrimarykey == true).DbColumnName;
|
var pk = this.ProPertyEntity.Columns.FirstOrDefault(it => it.IsPrimarykey == true)?.DbColumnName;
|
||||||
|
if (pk == null && Navigat.Name2 != null)
|
||||||
|
{
|
||||||
|
pk = this.ProPertyEntity.Columns.FirstOrDefault(it => it.PropertyName == Navigat.Name2)?.DbColumnName;
|
||||||
|
}
|
||||||
|
if(pk==null)
|
||||||
|
{
|
||||||
|
Check.ExceptionEasy(
|
||||||
|
true,
|
||||||
|
$"{this.ProPertyEntity.EntityName} naviate config error",
|
||||||
|
$"{this.ProPertyEntity.EntityName} 导航配置错误");
|
||||||
|
}
|
||||||
var name = this.EntityInfo.Columns.First(it => it.PropertyName == Navigat.Name).DbColumnName;
|
var name = this.EntityInfo.Columns.First(it => it.PropertyName == Navigat.Name).DbColumnName;
|
||||||
var selectName = this.ProPertyEntity.Columns.First(it => it.PropertyName ==MemberName).DbColumnName;
|
var selectName = this.ProPertyEntity.Columns.First(it => it.PropertyName ==MemberName).DbColumnName;
|
||||||
MapperSql mapper = new MapperSql();
|
MapperSql mapper = new MapperSql();
|
||||||
|
|||||||
Reference in New Issue
Block a user