mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-04-05 17:37:58 +08:00
Add unit test
This commit is contained in:
parent
4e1c178d24
commit
7a750390c9
@ -32,6 +32,7 @@ namespace OrmTest
|
|||||||
public static void Init()
|
public static void Init()
|
||||||
{
|
{
|
||||||
UnitGridSave.Init();
|
UnitGridSave.Init();
|
||||||
|
UnitNavDynamic.Init();
|
||||||
CrossDatabase01.Init();
|
CrossDatabase01.Init();
|
||||||
UnitStringToExp.Init();
|
UnitStringToExp.Init();
|
||||||
UnitOneToMany2.Init();
|
UnitOneToMany2.Init();
|
||||||
|
36
Src/Asp.NetCore2/SqlSeverTest/UnitTest/UnitNavDynamic.cs
Normal file
36
Src/Asp.NetCore2/SqlSeverTest/UnitTest/UnitNavDynamic.cs
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using SqlSugar;
|
||||||
|
namespace OrmTest
|
||||||
|
{
|
||||||
|
public class UnitNavDynamic
|
||||||
|
{
|
||||||
|
public static void Init()
|
||||||
|
{
|
||||||
|
var db = NewUnitTest.Db;
|
||||||
|
var list=db.Queryable<UnitAddress011>().Includes(x => x.Persons).ToList();
|
||||||
|
}
|
||||||
|
[SqlSugar.SugarTable("UnitPerson0x1x1")]
|
||||||
|
public class UnitPerson011
|
||||||
|
{
|
||||||
|
[SqlSugar.SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
|
||||||
|
public int Id { get; set; }
|
||||||
|
public string Name { get; set; }
|
||||||
|
public int AddressId { get; set; }
|
||||||
|
public int AddressId2 { get; set; }
|
||||||
|
}
|
||||||
|
[SqlSugar.SugarTable("UnitAddress0x1x1")]
|
||||||
|
public class UnitAddress011
|
||||||
|
{
|
||||||
|
[SqlSugar.SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
|
||||||
|
public int Id { get; set; }
|
||||||
|
public string Street { get; set; }
|
||||||
|
[SqlSugar.Navigate(SqlSugar.NavigateType.Dynamic, "[{m:\"Id\",c:\"AddressId\"},{m:\"Id\",c:\"AddressId\"}]")]
|
||||||
|
public List<UnitPerson011> Persons { get; set; }
|
||||||
|
//[SqlSugar.Navigate(SqlSugar.NavigateType.OneToMany, nameof(UnitPerson011.AddressId2))]
|
||||||
|
//public List<UnitPerson011> Persons2 { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user