- 优化 BaseDbProvider、AdoNetExtensions 内部定义;

This commit is contained in:
2881099
2021-03-03 11:46:03 +08:00
parent 1398514a96
commit 054fc4c805
4 changed files with 45 additions and 10 deletions

View File

@ -6,6 +6,7 @@ using FreeSql.Internal.Model;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Data.Odbc;
using System.Data.SqlClient;
using System.Data.SQLite;
@ -87,6 +88,17 @@ namespace base_entity
}
}
class B
{
public long Id { get; set; }
}
class A
{
public long BId { get; set; }
public B B { get; set; }
}
static void Main(string[] args)
{
#region IFreeSql
@ -121,10 +133,23 @@ namespace base_entity
.UseMonitorCommand(umcmd => Console.WriteLine(umcmd.CommandText))
.UseLazyLoading(true)
.UseGenerateCommandParameterWithLambda(true)
.Build();
BaseEntity.Initialization(fsql, () => _asyncUow.Value);
#endregion
fsql.UseJsonMap();
var bid1 = 10;
var list1 = fsql.Select<A>()
.Where(a => a.BId == bid1);
var aid1 = 11;
var select2 = fsql.Select<B>();
(select2 as Select0Provider)._params = (list1 as Select0Provider)._params;
var list2 = select2
.Where(a => list1.ToList(B => B.BId).Contains(a.Id))
.Where(a => a.Id == aid1)
.ToSql();
//fsql.Aop.CommandBefore += (s, e) =>
//{
// e.States["xxx"] = 111;