You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
using System.Collections.Generic;
namespace SqlSugar { internal class CacheKeyBuider { public static CacheKey GetKey(SqlSugarClient context, QueryBuilder queryBuilder) { var result = new CacheKey { Database = context.Context.Ado.Connection.Database }; AddTables(context, queryBuilder, result); AddIdentificationList(queryBuilder, result); return result; }
private static void AddIdentificationList(QueryBuilder queryBuilder, CacheKey result) { result.IdentificationList = new List<string>(); result.IdentificationList.Add(queryBuilder.GetTableNameString); result.IdentificationList.Add(queryBuilder.GetJoinValueString); result.IdentificationList.Add(queryBuilder.GetOrderByString); result.IdentificationList.Add(queryBuilder.GetGroupByString); result.IdentificationList.Add(queryBuilder.GetWhereValueString); result.IdentificationList.Add(queryBuilder.PartitionByValue); result.IdentificationList.Add(queryBuilder.Take.ObjToString()); result.IdentificationList.Add(queryBuilder.Skip.ObjToString()); if (queryBuilder.Parameters.HasValue()) { foreach (var item in queryBuilder.Parameters) { result.IdentificationList.Add(item.ParameterName + "_" + item.Value); } } }
private static void AddTables(SqlSugarClient context, QueryBuilder queryBuilder, CacheKey result) { result.Tables = new List<string>(); result.Tables.Add(context.EntityMaintenance.GetTableName(queryBuilder.EntityName)); if (queryBuilder.EasyJoinInfos.HasValue()) { foreach (var item in queryBuilder.EasyJoinInfos) { result.Tables.Add(context.EntityMaintenance.GetTableName(item.Value)); } } if (queryBuilder.JoinQueryInfos.HasValue()) { foreach (var item in queryBuilder.JoinQueryInfos) { result.Tables.Add(queryBuilder.Builder.GetNoTranslationColumnName(item.TableName)); } } } } }
|