From fb130077553e4690e7775af0e5f044694834aedf Mon Sep 17 00:00:00 2001 From: sunkaixuan <610262374@qq.com> Date: Fri, 29 Apr 2022 18:50:58 +0800 Subject: [PATCH] Update unit test --- .../SqlServerTest/SqlServerTest.csproj | 1 + Src/Asp.Net/SqlServerTest/UnitTest/Main.cs | 1 + .../SqlServerTest/UnitTest/UintDynamic.cs | 51 +++++++++++++++++++ 3 files changed, 53 insertions(+) create mode 100644 Src/Asp.Net/SqlServerTest/UnitTest/UintDynamic.cs diff --git a/Src/Asp.Net/SqlServerTest/SqlServerTest.csproj b/Src/Asp.Net/SqlServerTest/SqlServerTest.csproj index ed6c66add..2f1275954 100644 --- a/Src/Asp.Net/SqlServerTest/SqlServerTest.csproj +++ b/Src/Asp.Net/SqlServerTest/SqlServerTest.csproj @@ -94,6 +94,7 @@ + diff --git a/Src/Asp.Net/SqlServerTest/UnitTest/Main.cs b/Src/Asp.Net/SqlServerTest/UnitTest/Main.cs index 56f7a1881..783bf24f0 100644 --- a/Src/Asp.Net/SqlServerTest/UnitTest/Main.cs +++ b/Src/Asp.Net/SqlServerTest/UnitTest/Main.cs @@ -39,6 +39,7 @@ namespace OrmTest UCustom014.Init(); UCustom013.Init(); UCustom012.Init(); + UintDynamic.Init(); UCustom09.Init(); UCustom011.Init(); UCustom010.Init(); diff --git a/Src/Asp.Net/SqlServerTest/UnitTest/UintDynamic.cs b/Src/Asp.Net/SqlServerTest/UnitTest/UintDynamic.cs new file mode 100644 index 000000000..f3dc769cd --- /dev/null +++ b/Src/Asp.Net/SqlServerTest/UnitTest/UintDynamic.cs @@ -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() + .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 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; } + } + } +}