mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-10-20 18:47:35 +08:00
Add unit test
This commit is contained in:
@@ -99,6 +99,7 @@
|
||||
<Compile Include="Models\ViewOrder.cs" />
|
||||
<Compile Include="UnitTest\UInsert3.cs" />
|
||||
<Compile Include="UnitTest\Unitadfa1231.cs" />
|
||||
<Compile Include="UnitTest\UnitFilterasdfas.cs" />
|
||||
<Compile Include="UnitTest\UnitSubToList.cs" />
|
||||
<Compile Include="UnitTest\Models\EntityBase.cs" />
|
||||
<Compile Include="UnitTest\UnitByteArray.cs" />
|
||||
|
@@ -31,6 +31,7 @@ namespace OrmTest
|
||||
}
|
||||
public static void Init()
|
||||
{
|
||||
UnitFilterasdfas.Init();
|
||||
Unitadfa1231.Init();
|
||||
UInsert3.Init();
|
||||
USelectTest.Init();
|
||||
|
36
Src/Asp.Net/SqlServerTest/UnitTest/UnitFilterasdfas.cs
Normal file
36
Src/Asp.Net/SqlServerTest/UnitTest/UnitFilterasdfas.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OrmTest
|
||||
{
|
||||
public class UnitFilterasdfas
|
||||
{
|
||||
public static void Init()
|
||||
{
|
||||
var db = NewUnitTest.Db;
|
||||
db.CodeFirst.InitTables<UnitOrderA01, UnitOrderB02>();
|
||||
db.QueryFilter.AddTableFilter<IDeleted>(it => it.IsDeleted == false);
|
||||
var list = db.Queryable<UnitOrderA01>()
|
||||
.LeftJoin<UnitOrderB02>((x, t) => x.ID == t.ID)
|
||||
.LeftJoin<UnitOrderB02>((x, t,t2) => x.ID == t2.ID)
|
||||
.ToList();
|
||||
}
|
||||
public interface IDeleted
|
||||
{
|
||||
bool IsDeleted { get; set; }
|
||||
}
|
||||
public class UnitOrderA01 : IDeleted
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public bool IsDeleted { get; set; }
|
||||
}
|
||||
public class UnitOrderB02 : IDeleted
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public bool IsDeleted { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user