This commit is contained in:
sunkaixuan
2017-03-06 01:18:01 +08:00
parent d0c1946750
commit b58a99eeeb
3 changed files with 14 additions and 4 deletions

View File

@@ -8,5 +8,10 @@ namespace OrmTest.Models
{
public class ViewModelStudent:Student
{
}
public class ViewModelStudent2
{
public Student Student { get; set; }
}
}

View File

@@ -32,9 +32,12 @@ namespace OrmTest.UnitTest
//var list = db.Queryable<Student>()
// .Where(st => st.Id > 0)
// .Select(it => new ViewModelStudent { Name = it.Name }).ToList();
var list2 = db.Queryable<Student>()
.Where(st => st.Id > 0)
.Select("id").ToList();
//var list2 = db.Queryable<Student>()
// .Where(st => st.Id > 0)
// .Select("id").ToList();
var list3 = db.Queryable<Student>()
.Where(st => st.Id > 0)
.Select(it => new ViewModelStudent2 { Student = it }).ToList();
}
}