diff --git a/Src/Asp.Net/SqlServerTest/SqlServerTest.csproj b/Src/Asp.Net/SqlServerTest/SqlServerTest.csproj
index 84276c111..a4fc1e064 100644
--- a/Src/Asp.Net/SqlServerTest/SqlServerTest.csproj
+++ b/Src/Asp.Net/SqlServerTest/SqlServerTest.csproj
@@ -98,6 +98,7 @@
+
diff --git a/Src/Asp.Net/SqlServerTest/UnitTest/Main.cs b/Src/Asp.Net/SqlServerTest/UnitTest/Main.cs
index 4ffc6bdb8..935d8b7ed 100644
--- a/Src/Asp.Net/SqlServerTest/UnitTest/Main.cs
+++ b/Src/Asp.Net/SqlServerTest/UnitTest/Main.cs
@@ -31,6 +31,7 @@ namespace OrmTest
}
public static void Init()
{
+ UnitTestConfigQuery.Init();
UnitSub.Init();
UnitUpdateNavN3.Init();
UnitOneToOne12.Init();
diff --git a/Src/Asp.Net/SqlServerTest/UnitTest/UnitTestConfigQuery.cs b/Src/Asp.Net/SqlServerTest/UnitTest/UnitTestConfigQuery.cs
new file mode 100644
index 000000000..0f1793b91
--- /dev/null
+++ b/Src/Asp.Net/SqlServerTest/UnitTest/UnitTestConfigQuery.cs
@@ -0,0 +1,68 @@
+using SqlSugar;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace OrmTest
+{
+ public class UnitTestConfigQuery
+ {
+ public static void Init()
+ {
+
+ var db = NewUnitTest.Db;
+ db.CodeFirst.InitTables();
+ db.DbMaintenance.TruncateTable();
+ List datas = new List();
+ datas.Add(new DataDictionary1() { Code = "1", Name = "男", Type = "sex" });
+ datas.Add(new DataDictionary1() { Code = "2", Name = "女", Type = "sex" });
+ datas.Add(new DataDictionary1() { Code = "1", Name = "南通市", Type = "city" });
+ datas.Add(new DataDictionary1() { Code = "2", Name = "苏州市", Type = "city" });
+ datas.Add(new DataDictionary1() { Code = "1", Name = "江苏省", Type = "province" });
+ datas.Add(new DataDictionary1() { Code = "2", Name = "湖南省", Type = "province" });
+ db.Insertable(datas).ExecuteCommand();//这样就能把数据插进数据库了
+ db.Insertable(new DataMain() { SexCode="1", Province = "2" }).ExecuteCommand();
+ db.Insertable(new DataMain() { SexCode = "2", Province="1" }).ExecuteCommand();
+ db.Insertable(new DataMain() { SexCode = "3", Province = "1" }).ExecuteCommand();
+ var list=db.Queryable()
+ .Includes(x => x.SexInfo)
+ .Includes(x => x.ProvinceInfo)
+ .ToList();
+ if (list.First().SexInfo.Name != "男" || list.First().ProvinceInfo.Name != "湖南省"||
+ list.Last().SexInfo!=null)
+ {
+ throw new Exception("unit error");
+ }
+ var list2 = db.Queryable()
+ .Where(x=>x.SexInfo.Name=="男")
+ .ToList();
+ if (list2.Count == 0 || list2.First().SexCode != "1")
+ {
+ throw new Exception("unit error");
+ }
+ }
+ [SugarTable("UnitDataDictionary1")]
+ public class DataDictionary1
+ {
+ public string Code { get; set; }
+ public string Name { get; set; }
+ public string Type { get; set; }
+ }
+ [SugarTable("UnitDataMain")]
+ public class DataMain
+ {
+ public string SexCode { get; set; }
+ [SqlSugar.Navigate(NavigateType.OneToOne,nameof(SexCode),nameof(DataDictionary1.Code),"type='sex'")]
+ public DataDictionary1 SexInfo { get; set; }
+
+ public string Province { get; set; }
+ [SqlSugar.Navigate(NavigateType.OneToOne, nameof(Province), nameof(DataDictionary1.Code), "type='province'")]
+ public DataDictionary1 ProvinceInfo { get; set; }
+ }
+
+
+
+ }
+}