mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-12-17 17:41:28 +08:00
Synchronization code
This commit is contained in:
@@ -1335,7 +1335,7 @@ namespace SqlSugar
|
||||
}
|
||||
}
|
||||
|
||||
private string GetTableName(EntityInfo entity, string tableName)
|
||||
internal string GetTableName(EntityInfo entity, string tableName)
|
||||
{
|
||||
var oldTableName = tableName;
|
||||
var attr = entity?.Type?.GetCustomAttribute<TenantAttribute>();
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq.Expressions;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace SqlSugar
|
||||
{
|
||||
public class SubAsWithAttr : ISubOperation
|
||||
{
|
||||
public bool HasWhere
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
return "AsWithAttr";
|
||||
}
|
||||
}
|
||||
|
||||
public Expression Expression
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
|
||||
public int Sort
|
||||
{
|
||||
get
|
||||
{
|
||||
return 200;
|
||||
}
|
||||
}
|
||||
|
||||
public ExpressionContext Context
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
public string GetValue(Expression expression = null)
|
||||
{
|
||||
var exp = expression as MethodCallExpression;
|
||||
var type = exp.Type.GetGenericArguments()[0];
|
||||
var db = this.Context.SugarContext.Context;
|
||||
var entityInfo= db.EntityMaintenance.GetEntityInfo(type);
|
||||
var tableName = entityInfo.DbTableName;
|
||||
var queryable= ((QueryableProvider<object>)(db.Queryable<object>()));
|
||||
var expString = queryable.GetTableName(entityInfo, tableName);
|
||||
return "$SubAs:" + expString;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -39,7 +39,8 @@ namespace SqlSugar
|
||||
new SubSelectStringJoin{ Context=Context },
|
||||
new SubDistinctCount{ Context=Context },
|
||||
new SubToList{ Context=Context},
|
||||
new SubFirst(){ Context=Context }
|
||||
new SubFirst(){ Context=Context },
|
||||
new SubAsWithAttr(){ Context=Context }
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -219,5 +219,10 @@ namespace SqlSugar
|
||||
{
|
||||
return default(TResult);
|
||||
}
|
||||
|
||||
public Subqueryable<T> AsWithAttr()
|
||||
{
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,10 @@ namespace SqlSugar
|
||||
{ }
|
||||
public class Subqueryable<T1, T2, T3, T4, T5, T6, T7, T8, T9> : Subqueryable<T1> where T1 : class, new()
|
||||
{
|
||||
public new Subqueryable<T1, T2, T3, T4, T5, T6, T7, T8,T9> AsWithAttr()
|
||||
{
|
||||
return this;
|
||||
}
|
||||
public Subqueryable<T1, T2, T3, T4, T5, T6, T7, T8, T9, JoinType> InnerJoin<JoinType>(Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, JoinType, bool> expression)
|
||||
{
|
||||
return new Subqueryable<T1, T2, T3, T4, T5, T6, T7, T8, T9, JoinType>();
|
||||
@@ -68,6 +72,10 @@ namespace SqlSugar
|
||||
}
|
||||
public class Subqueryable<T1, T2, T3, T4, T5, T6, T7, T8> : Subqueryable<T1> where T1 : class, new()
|
||||
{
|
||||
public new Subqueryable<T1, T2, T3, T4, T5, T6, T7,T8> AsWithAttr()
|
||||
{
|
||||
return this;
|
||||
}
|
||||
public Subqueryable<T1, T2, T3, T4, T5, T6, T7, T8, JoinType> InnerJoin<JoinType>(Func<T1, T2, T3, T4, T5, T6, T7, T8, JoinType, bool> expression)
|
||||
{
|
||||
return new Subqueryable<T1, T2, T3, T4, T5, T6, T7, T8, JoinType>();
|
||||
@@ -123,6 +131,10 @@ namespace SqlSugar
|
||||
}
|
||||
public class Subqueryable<T1, T2, T3, T4, T5, T6, T7> : Subqueryable<T1> where T1 : class, new()
|
||||
{
|
||||
public new Subqueryable<T1, T2, T3, T4, T5, T6,T7> AsWithAttr()
|
||||
{
|
||||
return this;
|
||||
}
|
||||
public Subqueryable<T1, T2, T3, T4, T5, T6, T7, JoinType> InnerJoin<JoinType>(Func<T1, T2, T3, T4, T5, T6, T7, JoinType, bool> expression)
|
||||
{
|
||||
return new Subqueryable<T1, T2, T3, T4, T5, T6, T7, JoinType>();
|
||||
@@ -174,6 +186,10 @@ namespace SqlSugar
|
||||
}
|
||||
public class Subqueryable<T1, T2, T3, T4, T5, T6> : Subqueryable<T1> where T1 : class, new()
|
||||
{
|
||||
public new Subqueryable<T1, T2, T3, T4, T5,T6> AsWithAttr()
|
||||
{
|
||||
return this;
|
||||
}
|
||||
public new Subqueryable<T1, T2, T3, T4, T5, T6> Where(List<IConditionalModel> conditionals)
|
||||
{
|
||||
return this;
|
||||
@@ -226,6 +242,10 @@ namespace SqlSugar
|
||||
}
|
||||
public class Subqueryable<T1, T2, T3, T4, T5> : Subqueryable<T1> where T1 : class, new()
|
||||
{
|
||||
public new Subqueryable<T1, T2, T3, T4,T5> AsWithAttr()
|
||||
{
|
||||
return this;
|
||||
}
|
||||
public new Subqueryable<T1, T2, T3, T4,T5> Where(List<IConditionalModel> conditionals)
|
||||
{
|
||||
return this;
|
||||
@@ -274,6 +294,10 @@ namespace SqlSugar
|
||||
}
|
||||
public class Subqueryable<T1, T2, T3, T4> : Subqueryable<T1> where T1 : class, new()
|
||||
{
|
||||
public new Subqueryable<T1, T2, T3,T4> AsWithAttr()
|
||||
{
|
||||
return this;
|
||||
}
|
||||
public new Subqueryable<T1, T2, T3,T4> Where(List<IConditionalModel> conditionals)
|
||||
{
|
||||
return this;
|
||||
@@ -386,6 +410,10 @@ namespace SqlSugar
|
||||
}
|
||||
public class Subqueryable<T1, T2, T3> : Subqueryable<T1> where T1 : class, new()
|
||||
{
|
||||
public new Subqueryable<T1, T2,T3> AsWithAttr()
|
||||
{
|
||||
return this;
|
||||
}
|
||||
public new Subqueryable<T1, T2,T3> Where(List<IConditionalModel> conditionals)
|
||||
{
|
||||
return this;
|
||||
@@ -486,6 +514,10 @@ namespace SqlSugar
|
||||
}
|
||||
public class Subqueryable<T1, T2> : Subqueryable<T1> where T1 : class, new()
|
||||
{
|
||||
public new Subqueryable<T1,T2> AsWithAttr()
|
||||
{
|
||||
return this;
|
||||
}
|
||||
public new Subqueryable<T1,T2> Where(List<IConditionalModel> conditionals)
|
||||
{
|
||||
return this;
|
||||
|
||||
Reference in New Issue
Block a user