mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-19 01:58:13 +08:00
-
This commit is contained in:
12
OrmTest/Models/ViewModelStudent.cs
Normal file
12
OrmTest/Models/ViewModelStudent.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OrmTest.Models
|
||||
{
|
||||
public class ViewModelStudent:Student
|
||||
{
|
||||
}
|
||||
}
|
@@ -44,6 +44,7 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Config.cs" />
|
||||
<Compile Include="Models\ViewModelStudent.cs" />
|
||||
<Compile Include="UnitTest\ExpressionTest\ExpTestBase.cs" />
|
||||
<Compile Include="UnitTest\ExpressionTest\Field.cs" />
|
||||
<Compile Include="UnitTest\Query\JoinQuery.cs" />
|
||||
|
@@ -16,13 +16,13 @@ namespace OrmTest
|
||||
static void Main(string[] args)
|
||||
{
|
||||
//Unit Test
|
||||
int eachCount = 1;
|
||||
new Field(eachCount).Init();
|
||||
new Where(eachCount).Init();
|
||||
new Method(eachCount).Init();
|
||||
new JoinQuery(eachCount).Init();
|
||||
new SingleQuery(eachCount).Init();
|
||||
new SingleQuery(eachCount).Init();
|
||||
int eachCount = 1000;
|
||||
//new Field(eachCount).Init();
|
||||
//new Where(eachCount).Init();
|
||||
//new Method(eachCount).Init();
|
||||
//new JoinQuery(eachCount).Init();
|
||||
//new SingleQuery(eachCount).Init();
|
||||
new SelectQuery(eachCount).Init();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -29,7 +29,12 @@ namespace OrmTest.UnitTest
|
||||
{
|
||||
using (var db = GetInstance())
|
||||
{
|
||||
var list = db.Queryable<Student>().Where(st => st.Id > 0).ToList();
|
||||
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("*").ToList();
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user