mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-10-26 10:49:20 +08:00
4.6.0.9
This commit is contained in:
31
Src/Asp.Net/SqlServerTest/Demos/D_QueryableView.cs
Normal file
31
Src/Asp.Net/SqlServerTest/Demos/D_QueryableView.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using OrmTest.Models;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace OrmTest.Demo
|
||||
{
|
||||
public class D_QueryableViewn : DemoBase
|
||||
{
|
||||
public static void Init()
|
||||
{
|
||||
var db = GetInstance();
|
||||
var q1 = db.Queryable<Student, School>((st,sc)=>new object[] {
|
||||
JoinType.Left,st.SchoolId==sc.Id
|
||||
}).Select((st, sc) => new ViewModelStudent4() { Id=st.Id, Name=st.Name,SchoolName=sc.Name });
|
||||
|
||||
var q2 = db.Queryable<School>();
|
||||
|
||||
|
||||
var q3 = db.Queryable(q1, q2, (j1, j2) => j1.Id == j2.Id).Select((j1, j2) => j1).ToList();
|
||||
}
|
||||
}
|
||||
|
||||
public class ViewModelStudent4 {
|
||||
public int Id { get; set; }
|
||||
public string SchoolName { get; set; }
|
||||
public string Name { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -49,6 +49,7 @@ namespace OrmTest
|
||||
OrmTest.Demo.MasterSlave.Init();
|
||||
OrmTest.Demo.SharedConnection.Init();
|
||||
OrmTest.Demo.ExtSqlFun.Init();
|
||||
OrmTest.Demo.D_QueryableViewn.Init();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,6 +62,7 @@
|
||||
<Compile Include="Demos\1_Query.cs" />
|
||||
<Compile Include="Demos\2_Update.cs" />
|
||||
<Compile Include="Demos\A_MasterSlave.cs" />
|
||||
<Compile Include="Demos\D_QueryableView.cs" />
|
||||
<Compile Include="Models\DataTestInfo.cs" />
|
||||
<Compile Include="Models\DataTestInfo2.cs" />
|
||||
<Compile Include="Models\Enum.cs" />
|
||||
|
||||
Reference in New Issue
Block a user