Skip to content

Commit

Permalink
Add unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
DotNetNext committed Sep 29, 2023
1 parent 4e1c178 commit 7a75039
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
1 change: 1 addition & 0 deletions Src/Asp.NetCore2/SqlSeverTest/UnitTest/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public static void RestData()
public static void Init()
{
UnitGridSave.Init();
UnitNavDynamic.Init();
CrossDatabase01.Init();
UnitStringToExp.Init();
UnitOneToMany2.Init();
Expand Down
36 changes: 36 additions & 0 deletions Src/Asp.NetCore2/SqlSeverTest/UnitTest/UnitNavDynamic.cs
Original file line number Diff line number Diff line change
@@ -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; }
}
}
}

0 comments on commit 7a75039

Please sign in to comment.