mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-23 13:06:50 +08:00
Update unit test
This commit is contained in:
parent
0ba1390794
commit
fb13007755
@ -94,6 +94,7 @@
|
||||
<Compile Include="Models\OrderItem.cs" />
|
||||
<Compile Include="Demo\Demo0_SqlSugarClient.cs" />
|
||||
<Compile Include="Models\ViewOrder.cs" />
|
||||
<Compile Include="UnitTest\UintDynamic.cs" />
|
||||
<Compile Include="UnitTest\UnitManyToMany.cs" />
|
||||
<Compile Include="UnitTest\UCustom018.cs" />
|
||||
<Compile Include="UnitTest\Models\Order.cs" />
|
||||
|
@ -39,6 +39,7 @@ namespace OrmTest
|
||||
UCustom014.Init();
|
||||
UCustom013.Init();
|
||||
UCustom012.Init();
|
||||
UintDynamic.Init();
|
||||
UCustom09.Init();
|
||||
UCustom011.Init();
|
||||
UCustom010.Init();
|
||||
|
51
Src/Asp.Net/SqlServerTest/UnitTest/UintDynamic.cs
Normal file
51
Src/Asp.Net/SqlServerTest/UnitTest/UintDynamic.cs
Normal file
@ -0,0 +1,51 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using SqlSugar;
|
||||
namespace OrmTest
|
||||
{
|
||||
public class UintDynamic
|
||||
{
|
||||
public static void Init()
|
||||
{
|
||||
var db = NewUnitTest.Db;
|
||||
var list=db.Queryable<StudentA>()
|
||||
.Includes(it => it.Books.MappingField(z=>z.studenId,()=>it.StudentId)
|
||||
.MappingField(z => z.studenId, () => it.StudentId).ToList())
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public class StudentA
|
||||
{
|
||||
[SugarColumn(IsPrimaryKey = true)]
|
||||
public int StudentId { get; set; }
|
||||
public string Name { get; set; }
|
||||
[SugarColumn(IsNullable = true)]
|
||||
public int? SchoolId { get; set; }
|
||||
[Navigate(NavigateType.Dynamic,null)]
|
||||
public SchoolA SchoolA { get; set; }
|
||||
[Navigate(NavigateType.Dynamic, null)]
|
||||
public List<BookA> Books { get; set; }
|
||||
|
||||
}
|
||||
public class SchoolA
|
||||
{
|
||||
[SugarColumn(IsPrimaryKey = true)]
|
||||
public int SchoolId { get; set; }
|
||||
[SugarColumn(ColumnName = "SchoolName")]
|
||||
public string School_Name { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public class BookA
|
||||
{
|
||||
[SugarColumn(IsPrimaryKey = true)]
|
||||
public int BookId { get; set; }
|
||||
[SugarColumn(ColumnName = "Name")]
|
||||
public string Names { get; set; }
|
||||
public int studenId { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user