Browse Source

-

pull/12/MERGE
sunkaixuan 8 years ago
parent
commit
a3dcf0de83
  1. 10
      OrmTest/Demo/Query.cs
  2. 2
      OrmTest/Models/Student.cs

10
OrmTest/Demo/Query.cs

@ -103,13 +103,19 @@ namespace OrmTest.Demo
public static void Join()
{
var db = GetInstance();
//join
//join 2
var list = db.Queryable<Student, School>((st, sc) => new object[] {
JoinType.Left,st.SchoolId==sc.Id
}).ToList();
//join 3
var list2 = db.Queryable<Student, School,Student>((st, sc,st2) => new object[] {
JoinType.Left,st.SchoolId==sc.Id,
JoinType.Left,st.SchoolId==st2.Id
}).ToList();
//join return List<dynamic>
var list2 = db.Queryable<Student, School>((st, sc) => new object[] {
var list3 = db.Queryable<Student, School>((st, sc) => new object[] {
JoinType.Left,st.SchoolId==sc.Id
}).Select<Student,School,ViewModelStudent>((st,sc)=>new ViewModelStudent { Name= st.Name,SchoolId=sc.Id }).ToList();
}

2
OrmTest/Models/Student.cs

@ -16,7 +16,7 @@ namespace OrmTest.Models
public int Id { get; set; }
public int SchoolId { get; set; }
public string Name { get; set; }
public DateTime CreateTime { get; set; }
public DateTime? CreateTime { get; set; }
[SugarColumn(IsIgnore=true)]
[NotMappedAttribute]
public int TestId { get; set; }

Loading…
Cancel
Save