Browse Source

Update Join

pull/29/head
sunkaixuan 2 years ago
parent
commit
15ccd4f51b
  1. 28
      Src/Asp.Net/SqlSugar/Abstract/QueryableProvider/QueryableProvider.cs

28
Src/Asp.Net/SqlSugar/Abstract/QueryableProvider/QueryableProvider.cs

@ -48,6 +48,12 @@ namespace SqlSugar
public ISugarQueryable<T, T2> LeftJoin<T2>(ISugarQueryable<T2> joinQueryable, Expression<Func<T, T2, bool>> joinExpression)
{
if (MasterHasWhereFirstJoin())
{
return this.MergeTable().LeftJoin<T2>(joinExpression);
}
this.Context.InitMappingInfo<T2>();
var result = InstanceFactory.GetQueryable<T, T2>(this.Context.CurrentConnectionConfig);
result.SqlBuilder = this.SqlBuilder;
@ -65,6 +71,11 @@ namespace SqlSugar
}
public ISugarQueryable<T, T2> InnerJoin<T2>(ISugarQueryable<T2> joinQueryable, Expression<Func<T, T2, bool>> joinExpression)
{
if (MasterHasWhereFirstJoin())
{
return this.MergeTable().InnerJoin<T2>(joinExpression);
}
this.Context.InitMappingInfo<T2>();
var result = InstanceFactory.GetQueryable<T, T2>(this.Context.CurrentConnectionConfig);
result.SqlBuilder = this.SqlBuilder;
@ -82,6 +93,12 @@ namespace SqlSugar
}
public ISugarQueryable<T, T2> RightJoin<T2>(ISugarQueryable<T2> joinQueryable, Expression<Func<T, T2, bool>> joinExpression)
{
if (MasterHasWhereFirstJoin())
{
return this.MergeTable().RightJoin<T2>(joinExpression);
}
this.Context.InitMappingInfo<T2>();
var result = InstanceFactory.GetQueryable<T, T2>(this.Context.CurrentConnectionConfig);
result.SqlBuilder = this.SqlBuilder;
@ -99,6 +116,12 @@ namespace SqlSugar
}
public ISugarQueryable<T, T2> FullJoin<T2>(ISugarQueryable<T2> joinQueryable, Expression<Func<T, T2, bool>> joinExpression)
{
if (MasterHasWhereFirstJoin())
{
return this.MergeTable().FullJoin<T2>(joinExpression);
}
this.Context.InitMappingInfo<T2>();
var result = InstanceFactory.GetQueryable<T, T2>(this.Context.CurrentConnectionConfig);
result.SqlBuilder = this.SqlBuilder;
@ -116,6 +139,11 @@ namespace SqlSugar
}
public ISugarQueryable<T, T2> LeftJoin<T2>(Expression<Func<T, T2, bool>> joinExpression)
{
if (MasterHasWhereFirstJoin())
{
return this.MergeTable().LeftJoin<T2>(joinExpression);
}
this.Context.InitMappingInfo<T2>();
var result = InstanceFactory.GetQueryable<T, T2>(this.Context.CurrentConnectionConfig);
result.SqlBuilder = this.SqlBuilder;

Loading…
Cancel
Save