This commit is contained in:
sunkaixuan 2025-04-03 15:56:24 +08:00
parent e81c8e1fca
commit a7936acbe1

View File

@ -4,6 +4,7 @@ using System.Collections.Generic;
using System.Linq.Dynamic.Core;
using System.Linq.Dynamic.Core.CustomTypeProviders;
using System.Text;
using static OrmTest.UnitOneToManyFiltersadfa;
namespace OrmTest
{
@ -128,8 +129,24 @@ namespace OrmTest
.Where("it", $"SqlFunc.Exists(it.Address.Id)")
.OrderBy((it, y) => it.Id)
.ToList();
//Select实现返回导航属性
var list66 = db.Queryable<UnitPerson011>()
.Includes(it => it.Address)
.Select(it => new
{
addid=it.Address.Id,
Address =it.Address
}).ToList();
var list666 = db.Queryable<UnitPerson011>()
.Includes(it=>it.Address)
.Select("it",
new List<string>()
{
" it.Address.Id as addid" ,
"it.Address as Address"
}
)
.ToList();
var xxx = DynamicCoreHelper.GetMember(typeof(UnitPerson011), typeof(int), "it", $"it.Address.Id ");
var list7= db.Queryable<UnitPerson011>().Select<int>("it", $"it.Address.Id ",typeof(UnitPerson011), typeof(int)).ToList();
var list8 = db.Queryable<Order>().Select("it", $"new(it.Id as Id, it.Name)", typeof(Order)).ToList();