单元测试缓存,并且移除表达式编译缓存功能
This commit is contained in:
parent
318e51bbf0
commit
28c6aa1fbd
|
@ -113,7 +113,7 @@ namespace ShardingCore6x
|
|||
}
|
||||
|
||||
|
||||
[Params(1)]
|
||||
[Params(10)]
|
||||
public int N;
|
||||
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ namespace ShardingCore6x.ShardingDbContexts
|
|||
{
|
||||
internal class OrderVirtualTableRoute:AbstractSimpleShardingModKeyStringVirtualTableRoute<Order>
|
||||
{
|
||||
public override bool? EnableRouteParseCompileCache => true;
|
||||
////public override bool? EnableRouteParseCompileCache => true;
|
||||
|
||||
public OrderVirtualTableRoute() : base(2, 5)
|
||||
{
|
||||
|
|
|
@ -30,7 +30,7 @@ builder.Services.AddShardingDbContext<DefaultDbContext>()
|
|||
.AddConfig(o =>
|
||||
{
|
||||
o.ConfigId = "c1";
|
||||
o.AddDefaultDataSource("ds0", "server=127.0.0.1;port=3306;database=shardingTest;userid=root;password=root;");
|
||||
o.AddDefaultDataSource("ds0", "server=127.0.0.1;port=3306;database=shardingTest;userid=root;password=L6yBtV6qNENrwBy7;");
|
||||
o.UseShardingQuery((conn, b) =>
|
||||
{
|
||||
b.UseMySql(conn, new MySqlServerVersion(new Version())).UseLoggerFactory(efLogger);
|
||||
|
|
|
@ -31,16 +31,16 @@ namespace ShardingCore.Core.ShardingConfigurations.Abstractions
|
|||
/// 忽略建表时的错误
|
||||
/// </summary>
|
||||
bool? IgnoreCreateTableError { get; set; }
|
||||
/// <summary>
|
||||
/// 是否启用分表路由编译缓存(默认只缓存单个操作的也就是<![CDATA[=,>,>=,<,<=]]>)
|
||||
/// default cache single filter route expression, <![CDATA[=,>,>=,<,<=]]> with sharding property
|
||||
/// </summary>
|
||||
bool? EnableTableRouteCompileCache { get; set; }
|
||||
/// <summary>
|
||||
/// 是否启用分库路由编译缓存(默认只缓存单个操作的也就是<![CDATA[=,>,>=,<,<=]]>)
|
||||
/// default cache single filter route expression, <![CDATA[=,>,>=,<,<=]]> with sharding property
|
||||
/// </summary>
|
||||
bool? EnableDataSourceRouteCompileCache { get; set; }
|
||||
///// <summary>
|
||||
///// 是否启用分表路由编译缓存(默认只缓存单个操作的也就是<![CDATA[=,>,>=,<,<=]]>)
|
||||
///// default cache single filter route expression, <![CDATA[=,>,>=,<,<=]]> with sharding property
|
||||
///// </summary>
|
||||
//bool? EnableTableRouteCompileCache { get; set; }
|
||||
///// <summary>
|
||||
///// 是否启用分库路由编译缓存(默认只缓存单个操作的也就是<![CDATA[=,>,>=,<,<=]]>)
|
||||
///// default cache single filter route expression, <![CDATA[=,>,>=,<,<=]]> with sharding property
|
||||
///// </summary>
|
||||
//bool? EnableDataSourceRouteCompileCache { get; set; }
|
||||
/// <summary>
|
||||
/// 添加分库路由
|
||||
/// </summary>
|
||||
|
|
|
@ -38,14 +38,14 @@ namespace ShardingCore.Core.ShardingConfigurations
|
|||
/// 当查询遇到没有路由被命中时是否抛出错误
|
||||
/// </summary>
|
||||
public bool ThrowIfQueryRouteNotMatch { get; set; } = true;
|
||||
/// <summary>
|
||||
/// 全局启用分表路由表达式缓存,仅缓存单个表达式
|
||||
/// </summary>
|
||||
public bool? EnableTableRouteCompileCache { get; set; }
|
||||
/// <summary>
|
||||
/// 全局启用分库路由表达式缓存,仅缓存单个表达式
|
||||
/// </summary>
|
||||
public bool? EnableDataSourceRouteCompileCache { get; set; }
|
||||
///// <summary>
|
||||
///// 全局启用分表路由表达式缓存,仅缓存单个表达式
|
||||
///// </summary>
|
||||
//public bool? EnableTableRouteCompileCache { get; set; }
|
||||
///// <summary>
|
||||
///// 全局启用分库路由表达式缓存,仅缓存单个表达式
|
||||
///// </summary>
|
||||
//public bool? EnableDataSourceRouteCompileCache { get; set; }
|
||||
/// <summary>
|
||||
/// 忽略建表时的错误
|
||||
/// </summary>
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace ShardingCore.Core.VirtualRoutes.DataSourceRoutes.Abstractions
|
|||
/// </summary>
|
||||
/// <typeparam name="TEntity"></typeparam>
|
||||
/// <typeparam name="TKey"></typeparam>
|
||||
public abstract class AbstractShardingOperatorVirtualDataSourceRoute<TEntity, TKey> : AbstractShardingRouteParseCompileCacheVirtualDataSourceRoute<TEntity, TKey> where TEntity : class
|
||||
public abstract class AbstractShardingOperatorVirtualDataSourceRoute<TEntity, TKey> : AbstractShardingFilterVirtualDataSourceRoute<TEntity, TKey> where TEntity : class
|
||||
{
|
||||
protected override List<string> DoRouteWithPredicate(List<string> allDataSourceNames, IQueryable queryable)
|
||||
{
|
||||
|
|
|
@ -1,94 +1,94 @@
|
|||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ShardingCore.Extensions;
|
||||
using ShardingCore.Sharding.Visitors;
|
||||
//using System;
|
||||
//using System.Collections.Concurrent;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Linq;
|
||||
//using System.Linq.Expressions;
|
||||
//using System.Text;
|
||||
//using System.Threading.Tasks;
|
||||
//using ShardingCore.Extensions;
|
||||
//using ShardingCore.Sharding.Visitors;
|
||||
|
||||
namespace ShardingCore.Core.VirtualRoutes.DataSourceRoutes.Abstractions
|
||||
{
|
||||
/// <summary>
|
||||
/// 分库路由表达式解析缓存
|
||||
/// </summary>
|
||||
/// <typeparam name="TEntity"></typeparam>
|
||||
/// <typeparam name="TKey"></typeparam>
|
||||
public abstract class AbstractShardingRouteParseCompileCacheVirtualDataSourceRoute<TEntity, TKey> : AbstractShardingFilterVirtualDataSourceRoute<TEntity, TKey> where TEntity : class
|
||||
{
|
||||
private static readonly ConcurrentDictionary<Expression<Func<string, bool>>, Func<string, bool>> _routeCompileCaches = new(new ExtensionExpressionComparer.RouteParseExpressionEqualityComparer());
|
||||
static AbstractShardingRouteParseCompileCacheVirtualDataSourceRoute()
|
||||
{
|
||||
Expression<Func<string, bool>> defaultWhere1 = x => true;
|
||||
_routeCompileCaches.TryAdd(defaultWhere1, defaultWhere1.Compile());
|
||||
Expression<Func<string, bool>> defaultWhere2 = x => true;
|
||||
var expression = defaultWhere2.And(defaultWhere1);
|
||||
_routeCompileCaches.TryAdd(expression, expression.Compile());
|
||||
}
|
||||
/// <summary>
|
||||
/// 是否启用路由解析编译缓存
|
||||
/// </summary>
|
||||
public virtual bool? EnableRouteParseCompileCache => null;
|
||||
//namespace ShardingCore.Core.VirtualRoutes.DataSourceRoutes.Abstractions
|
||||
//{
|
||||
// /// <summary>
|
||||
// /// 分库路由表达式解析缓存
|
||||
// /// </summary>
|
||||
// /// <typeparam name="TEntity"></typeparam>
|
||||
// /// <typeparam name="TKey"></typeparam>
|
||||
// public abstract class AbstractShardingRouteParseCompileCacheVirtualDataSourceRoute<TEntity, TKey> : AbstractShardingFilterVirtualDataSourceRoute<TEntity, TKey> where TEntity : class
|
||||
// {
|
||||
// private static readonly ConcurrentDictionary<Expression<Func<string, bool>>, Func<string, bool>> _routeCompileCaches = new(new ExtensionExpressionComparer.RouteParseExpressionEqualityComparer());
|
||||
// static AbstractShardingRouteParseCompileCacheVirtualDataSourceRoute()
|
||||
// {
|
||||
// Expression<Func<string, bool>> defaultWhere1 = x => true;
|
||||
// _routeCompileCaches.TryAdd(defaultWhere1, defaultWhere1.Compile());
|
||||
// Expression<Func<string, bool>> defaultWhere2 = x => true;
|
||||
// var expression = defaultWhere2.And(defaultWhere1);
|
||||
// _routeCompileCaches.TryAdd(expression, expression.Compile());
|
||||
// }
|
||||
// /// <summary>
|
||||
// /// 是否启用路由解析编译缓存
|
||||
// /// </summary>
|
||||
// public virtual bool? EnableRouteParseCompileCache => null;
|
||||
|
||||
public virtual bool EnableCompileCache()
|
||||
{
|
||||
if (EnableRouteParseCompileCache.HasValue)
|
||||
return EnableRouteParseCompileCache.Value;
|
||||
return EntityConfigOptions.EnableDataSourceRouteCompileCache.GetValueOrDefault();
|
||||
}
|
||||
// public virtual bool EnableCompileCache()
|
||||
// {
|
||||
// if (EnableRouteParseCompileCache.HasValue)
|
||||
// return EnableRouteParseCompileCache.Value;
|
||||
// return EntityConfigOptions.EnableDataSourceRouteCompileCache.GetValueOrDefault();
|
||||
// }
|
||||
|
||||
/// <summary>
|
||||
/// 对表达式进行缓存编译默认永久缓存单个参数表达式,且不包含orElse只包含单个AndAlso或者没有AndAlso的,
|
||||
/// 比如:<![CDATA[o.id==x]]>或者<![CDATA[o.id>x]]>,不会缓存<![CDATA[o=>id>x && o.id<y ]]>等一共大于、等于、小于、大于等于、小于等于(不等于编译成<![CDATA[t=>true]]>)缓存会存在的数量个数上限为
|
||||
/// 表后缀x*5+2,当前表如果有300个后缀那么就是1502个缓存结果额外两个为<![CDATA[o=>true]]>和<![CDATA[o=>true and true]]>
|
||||
/// </summary>
|
||||
/// <param name="parseWhere"></param>
|
||||
/// <returns></returns>
|
||||
public virtual Func<string, bool> CachingCompile(Expression<Func<string, bool>> parseWhere)
|
||||
{
|
||||
if (EnableCompileCache())
|
||||
{
|
||||
var doCachingCompile = DoCachingCompile(parseWhere);
|
||||
if (doCachingCompile != null)
|
||||
return doCachingCompile;
|
||||
doCachingCompile = CustomerCachingCompile(parseWhere);
|
||||
if (doCachingCompile != null)
|
||||
return doCachingCompile;
|
||||
}
|
||||
return parseWhere.Compile();
|
||||
}
|
||||
/// <summary>
|
||||
/// 系统默认永久单表达式缓存
|
||||
/// </summary>
|
||||
/// <param name="parseWhere"></param>
|
||||
/// <returns>返回null会走<see cref="CustomerCachingCompile"/>这个方法如果还是null就会调用<see cref="Compile"/>方法</returns>
|
||||
protected virtual Func<string, bool> DoCachingCompile(Expression<Func<string, bool>> parseWhere)
|
||||
{
|
||||
var shouldCache = ShouldCache(parseWhere);
|
||||
if (shouldCache)
|
||||
return _routeCompileCaches.GetOrAdd(parseWhere, key => parseWhere.Compile());
|
||||
return null;
|
||||
}
|
||||
/// <summary>
|
||||
/// 表达式是否应该被缓存默认没有or并且and只有一个或者没有
|
||||
/// </summary>
|
||||
/// <param name="whereExpression"></param>
|
||||
/// <returns></returns>
|
||||
protected bool ShouldCache(Expression whereExpression)
|
||||
{
|
||||
var routeParseCacheExpressionVisitor = new RouteParseCacheExpressionVisitor();
|
||||
routeParseCacheExpressionVisitor.Visit(whereExpression);
|
||||
if (routeParseCacheExpressionVisitor.HasOrElse())
|
||||
return false;
|
||||
if (routeParseCacheExpressionVisitor.AndAlsoCount() > 1)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
// /// <summary>
|
||||
// /// 对表达式进行缓存编译默认永久缓存单个参数表达式,且不包含orElse只包含单个AndAlso或者没有AndAlso的,
|
||||
// /// 比如:<![CDATA[o.id==x]]>或者<![CDATA[o.id>x]]>,不会缓存<![CDATA[o=>id>x && o.id<y ]]>等一共大于、等于、小于、大于等于、小于等于(不等于编译成<![CDATA[t=>true]]>)缓存会存在的数量个数上限为
|
||||
// /// 表后缀x*5+2,当前表如果有300个后缀那么就是1502个缓存结果额外两个为<![CDATA[o=>true]]>和<![CDATA[o=>true and true]]>
|
||||
// /// </summary>
|
||||
// /// <param name="parseWhere"></param>
|
||||
// /// <returns></returns>
|
||||
// public virtual Func<string, bool> CachingCompile(Expression<Func<string, bool>> parseWhere)
|
||||
// {
|
||||
// if (EnableCompileCache())
|
||||
// {
|
||||
// var doCachingCompile = DoCachingCompile(parseWhere);
|
||||
// if (doCachingCompile != null)
|
||||
// return doCachingCompile;
|
||||
// doCachingCompile = CustomerCachingCompile(parseWhere);
|
||||
// if (doCachingCompile != null)
|
||||
// return doCachingCompile;
|
||||
// }
|
||||
// return parseWhere.Compile();
|
||||
// }
|
||||
// /// <summary>
|
||||
// /// 系统默认永久单表达式缓存
|
||||
// /// </summary>
|
||||
// /// <param name="parseWhere"></param>
|
||||
// /// <returns>返回null会走<see cref="CustomerCachingCompile"/>这个方法如果还是null就会调用<see cref="Compile"/>方法</returns>
|
||||
// protected virtual Func<string, bool> DoCachingCompile(Expression<Func<string, bool>> parseWhere)
|
||||
// {
|
||||
// var shouldCache = ShouldCache(parseWhere);
|
||||
// if (shouldCache)
|
||||
// return _routeCompileCaches.GetOrAdd(parseWhere, key => parseWhere.Compile());
|
||||
// return null;
|
||||
// }
|
||||
// /// <summary>
|
||||
// /// 表达式是否应该被缓存默认没有or并且and只有一个或者没有
|
||||
// /// </summary>
|
||||
// /// <param name="whereExpression"></param>
|
||||
// /// <returns></returns>
|
||||
// protected bool ShouldCache(Expression whereExpression)
|
||||
// {
|
||||
// var routeParseCacheExpressionVisitor = new RouteParseCacheExpressionVisitor();
|
||||
// routeParseCacheExpressionVisitor.Visit(whereExpression);
|
||||
// if (routeParseCacheExpressionVisitor.HasOrElse())
|
||||
// return false;
|
||||
// if (routeParseCacheExpressionVisitor.AndAlsoCount() > 1)
|
||||
// return false;
|
||||
// return true;
|
||||
// }
|
||||
|
||||
protected virtual Func<string, bool> CustomerCachingCompile(Expression<Func<string, bool>> parseWhere)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
// protected virtual Func<string, bool> CustomerCachingCompile(Expression<Func<string, bool>> parseWhere)
|
||||
// {
|
||||
// return null;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace ShardingCore.Core.VirtualRoutes.TableRoutes.Abstractions
|
|||
* @Date: Saturday, 19 December 2020 19:55:24
|
||||
* @Email: 326308290@qq.com
|
||||
*/
|
||||
public abstract class AbstractShardingOperatorVirtualTableRoute<TEntity, TKey> : AbstractShardingRouteParseCompileCacheVirtualTableRoute<TEntity, TKey> where TEntity : class
|
||||
public abstract class AbstractShardingOperatorVirtualTableRoute<TEntity, TKey> : AbstractShardingFilterVirtualTableRoute<TEntity, TKey> where TEntity : class
|
||||
{
|
||||
protected override List<IPhysicTable> DoRouteWithPredicate(List<IPhysicTable> allPhysicTables, IQueryable queryable)
|
||||
{
|
||||
|
|
|
@ -1,95 +1,95 @@
|
|||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ShardingCore.Core.EntityMetadatas;
|
||||
using ShardingCore.Core.PhysicTables;
|
||||
using ShardingCore.Extensions;
|
||||
using ShardingCore.Sharding.Visitors;
|
||||
//using System;
|
||||
//using System.Collections.Concurrent;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Linq;
|
||||
//using System.Linq.Expressions;
|
||||
//using System.Text;
|
||||
//using System.Threading.Tasks;
|
||||
//using ShardingCore.Core.EntityMetadatas;
|
||||
//using ShardingCore.Core.PhysicTables;
|
||||
//using ShardingCore.Extensions;
|
||||
//using ShardingCore.Sharding.Visitors;
|
||||
|
||||
namespace ShardingCore.Core.VirtualRoutes.TableRoutes.Abstractions
|
||||
{
|
||||
/// <summary>
|
||||
/// 路由解析缓存
|
||||
/// </summary>
|
||||
/// <typeparam name="TEntity"></typeparam>
|
||||
/// <typeparam name="TKey"></typeparam>
|
||||
public abstract class AbstractShardingRouteParseCompileCacheVirtualTableRoute<TEntity, TKey> : AbstractShardingFilterVirtualTableRoute<TEntity, TKey> where TEntity : class
|
||||
{
|
||||
private readonly ConcurrentDictionary<Expression<Func<string, bool>>, Func<string, bool>> _routeCompileCaches = new(new ExtensionExpressionComparer.RouteParseExpressionEqualityComparer());
|
||||
//namespace ShardingCore.Core.VirtualRoutes.TableRoutes.Abstractions
|
||||
//{
|
||||
// /// <summary>
|
||||
// /// 路由解析缓存
|
||||
// /// </summary>
|
||||
// /// <typeparam name="TEntity"></typeparam>
|
||||
// /// <typeparam name="TKey"></typeparam>
|
||||
// public abstract class AbstractShardingRouteParseCompileCacheVirtualTableRoute<TEntity, TKey> : AbstractShardingFilterVirtualTableRoute<TEntity, TKey> where TEntity : class
|
||||
// {
|
||||
// private readonly ConcurrentDictionary<Expression<Func<string, bool>>, Func<string, bool>> _routeCompileCaches = new(new ExtensionExpressionComparer.RouteParseExpressionEqualityComparer());
|
||||
|
||||
protected AbstractShardingRouteParseCompileCacheVirtualTableRoute()
|
||||
{
|
||||
Expression<Func<string, bool>> defaultWhere1 = x => true;
|
||||
_routeCompileCaches.TryAdd(defaultWhere1, defaultWhere1.Compile());
|
||||
Expression<Func<string, bool>> defaultWhere2 = x => true;
|
||||
var expression = defaultWhere2.And(defaultWhere1);
|
||||
_routeCompileCaches.TryAdd(expression, expression.Compile());
|
||||
}
|
||||
/// <summary>
|
||||
/// 是否启用路由解析编译缓存
|
||||
/// </summary>
|
||||
public virtual bool? EnableRouteParseCompileCache => null;
|
||||
public virtual bool EnableCompileCache()
|
||||
{
|
||||
if (EnableRouteParseCompileCache.HasValue)
|
||||
return EnableRouteParseCompileCache.Value;
|
||||
return EntityConfigOptions.EnableTableRouteCompileCache.GetValueOrDefault();
|
||||
}
|
||||
/// <summary>
|
||||
/// 对表达式进行缓存编译默认永久缓存单个参数表达式,且不包含orElse只包含单个AndAlso或者没有AndAlso的,
|
||||
/// 比如:<![CDATA[o.id==x]]>或者<![CDATA[o.id>x]]>,不会缓存<![CDATA[o=>id>x && o.id<y ]]>等一共大于、等于、小于、大于等于、小于等于(不等于编译成<![CDATA[t=>true]]>)缓存会存在的数量个数上限为
|
||||
/// 表后缀x*5+2,当前表如果有300个后缀那么就是1502个缓存结果额外两个为<![CDATA[o=>true]]>和<![CDATA[o=>true and true]]>
|
||||
/// </summary>
|
||||
/// <param name="parseWhere"></param>
|
||||
/// <returns></returns>
|
||||
public virtual Func<string, bool> CachingCompile(Expression<Func<string, bool>> parseWhere)
|
||||
{
|
||||
if (EnableCompileCache())
|
||||
{
|
||||
var doCachingCompile = DoCachingCompile(parseWhere);
|
||||
if (doCachingCompile != null)
|
||||
return doCachingCompile;
|
||||
doCachingCompile = CustomerCachingCompile(parseWhere);
|
||||
if (doCachingCompile != null)
|
||||
return doCachingCompile;
|
||||
}
|
||||
return parseWhere.Compile();
|
||||
}
|
||||
/// <summary>
|
||||
/// 系统默认永久单表达式缓存
|
||||
/// </summary>
|
||||
/// <param name="parseWhere"></param>
|
||||
/// <returns>返回null会走<see cref="CustomerCachingCompile"/>这个方法如果还是null就会调用<see cref="LambdaExpression.Compile()"/>方法</returns>
|
||||
protected virtual Func<string, bool> DoCachingCompile(Expression<Func<string, bool>> parseWhere)
|
||||
{
|
||||
var shouldCache = ShouldCache(parseWhere);
|
||||
if(shouldCache)
|
||||
return _routeCompileCaches.GetOrAdd(parseWhere, key => parseWhere.Compile());
|
||||
return null;
|
||||
}
|
||||
/// <summary>
|
||||
/// 表达式是否应该被缓存默认没有or并且and只有一个或者没有
|
||||
/// </summary>
|
||||
/// <param name="whereExpression"></param>
|
||||
/// <returns></returns>
|
||||
protected bool ShouldCache(Expression whereExpression)
|
||||
{
|
||||
var routeParseCacheExpressionVisitor = new RouteParseCacheExpressionVisitor();
|
||||
routeParseCacheExpressionVisitor.Visit(whereExpression);
|
||||
if (routeParseCacheExpressionVisitor.HasOrElse())
|
||||
return false;
|
||||
if (routeParseCacheExpressionVisitor.AndAlsoCount() > 1)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
// protected AbstractShardingRouteParseCompileCacheVirtualTableRoute()
|
||||
// {
|
||||
// Expression<Func<string, bool>> defaultWhere1 = x => true;
|
||||
// _routeCompileCaches.TryAdd(defaultWhere1, defaultWhere1.Compile());
|
||||
// Expression<Func<string, bool>> defaultWhere2 = x => true;
|
||||
// var expression = defaultWhere2.And(defaultWhere1);
|
||||
// _routeCompileCaches.TryAdd(expression, expression.Compile());
|
||||
// }
|
||||
// /// <summary>
|
||||
// /// 是否启用路由解析编译缓存
|
||||
// /// </summary>
|
||||
// public virtual bool? EnableRouteParseCompileCache => null;
|
||||
// public virtual bool EnableCompileCache()
|
||||
// {
|
||||
// if (EnableRouteParseCompileCache.HasValue)
|
||||
// return EnableRouteParseCompileCache.Value;
|
||||
// return EntityConfigOptions.EnableTableRouteCompileCache.GetValueOrDefault();
|
||||
// }
|
||||
// /// <summary>
|
||||
// /// 对表达式进行缓存编译默认永久缓存单个参数表达式,且不包含orElse只包含单个AndAlso或者没有AndAlso的,
|
||||
// /// 比如:<![CDATA[o.id==x]]>或者<![CDATA[o.id>x]]>,不会缓存<![CDATA[o=>id>x && o.id<y ]]>等一共大于、等于、小于、大于等于、小于等于(不等于编译成<![CDATA[t=>true]]>)缓存会存在的数量个数上限为
|
||||
// /// 表后缀x*5+2,当前表如果有300个后缀那么就是1502个缓存结果额外两个为<![CDATA[o=>true]]>和<![CDATA[o=>true and true]]>
|
||||
// /// </summary>
|
||||
// /// <param name="parseWhere"></param>
|
||||
// /// <returns></returns>
|
||||
// public virtual Func<string, bool> CachingCompile(Expression<Func<string, bool>> parseWhere)
|
||||
// {
|
||||
// if (EnableCompileCache())
|
||||
// {
|
||||
// var doCachingCompile = DoCachingCompile(parseWhere);
|
||||
// if (doCachingCompile != null)
|
||||
// return doCachingCompile;
|
||||
// doCachingCompile = CustomerCachingCompile(parseWhere);
|
||||
// if (doCachingCompile != null)
|
||||
// return doCachingCompile;
|
||||
// }
|
||||
// return parseWhere.Compile();
|
||||
// }
|
||||
// /// <summary>
|
||||
// /// 系统默认永久单表达式缓存
|
||||
// /// </summary>
|
||||
// /// <param name="parseWhere"></param>
|
||||
// /// <returns>返回null会走<see cref="CustomerCachingCompile"/>这个方法如果还是null就会调用<see cref="LambdaExpression.Compile()"/>方法</returns>
|
||||
// protected virtual Func<string, bool> DoCachingCompile(Expression<Func<string, bool>> parseWhere)
|
||||
// {
|
||||
// var shouldCache = ShouldCache(parseWhere);
|
||||
// if(shouldCache)
|
||||
// return _routeCompileCaches.GetOrAdd(parseWhere, key => parseWhere.Compile());
|
||||
// return null;
|
||||
// }
|
||||
// /// <summary>
|
||||
// /// 表达式是否应该被缓存默认没有or并且and只有一个或者没有
|
||||
// /// </summary>
|
||||
// /// <param name="whereExpression"></param>
|
||||
// /// <returns></returns>
|
||||
// protected bool ShouldCache(Expression whereExpression)
|
||||
// {
|
||||
// var routeParseCacheExpressionVisitor = new RouteParseCacheExpressionVisitor();
|
||||
// routeParseCacheExpressionVisitor.Visit(whereExpression);
|
||||
// if (routeParseCacheExpressionVisitor.HasOrElse())
|
||||
// return false;
|
||||
// if (routeParseCacheExpressionVisitor.AndAlsoCount() > 1)
|
||||
// return false;
|
||||
// return true;
|
||||
// }
|
||||
|
||||
protected virtual Func<string, bool> CustomerCachingCompile(Expression<Func<string, bool>> parseWhere)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
// protected virtual Func<string, bool> CustomerCachingCompile(Expression<Func<string, bool>> parseWhere)
|
||||
// {
|
||||
// return null;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
|
|
@ -17,8 +17,11 @@
|
|||
<LangVersion>latest</LangVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Remove="Core\VirtualRoutes\RouteConditions\**" />
|
||||
<Compile Remove="Sharding\Abstractions\MergeParseContexts\**" />
|
||||
<EmbeddedResource Remove="Core\VirtualRoutes\RouteConditions\**" />
|
||||
<EmbeddedResource Remove="Sharding\Abstractions\MergeParseContexts\**" />
|
||||
<None Remove="Core\VirtualRoutes\RouteConditions\**" />
|
||||
<None Remove="Sharding\Abstractions\MergeParseContexts\**" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
@ -34,7 +37,6 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Core\VirtualRoutes\RouteConditions" />
|
||||
<Folder Include="Sharding\Visitors\GroupBys" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace ShardingCore.Test.Shardings
|
|||
{
|
||||
public class LogDayLongVirtualRoute:AbstractSimpleShardingDayKeyLongVirtualTableRoute<LogDayLong>
|
||||
{
|
||||
public override bool? EnableRouteParseCompileCache => true;
|
||||
//public override bool? EnableRouteParseCompileCache => true;
|
||||
protected override bool EnableHintRoute => true;
|
||||
|
||||
public override void Configure(EntityMetadataTableBuilder<LogDayLong> builder)
|
||||
|
|
|
@ -10,7 +10,7 @@ namespace ShardingCore.Test.Shardings
|
|||
{
|
||||
public class LogDayVirtualTableRoute:AbstractSimpleShardingDayKeyDateTimeVirtualTableRoute<LogDay>
|
||||
{
|
||||
public override bool? EnableRouteParseCompileCache => true;
|
||||
//public override bool? EnableRouteParseCompileCache => true;
|
||||
protected override bool EnableHintRoute => true;
|
||||
|
||||
public override DateTime GetBeginTime()
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace ShardingCore.Test.Shardings
|
|||
{
|
||||
public class LogMonthLongvirtualRoute:AbstractSimpleShardingMonthKeyLongVirtualTableRoute<LogMonthLong>
|
||||
{
|
||||
public override bool? EnableRouteParseCompileCache => true;
|
||||
//public override bool? EnableRouteParseCompileCache => true;
|
||||
protected override bool EnableHintRoute => true;
|
||||
|
||||
public override bool AutoCreateTableByTime()
|
||||
|
|
|
@ -7,7 +7,7 @@ namespace ShardingCore.Test.Shardings
|
|||
{
|
||||
public class LogWeekDateTimeVirtualTableRoute:AbstractSimpleShardingWeekKeyDateTimeVirtualTableRoute<LogWeekDateTime>
|
||||
{
|
||||
public override bool? EnableRouteParseCompileCache => true;
|
||||
//public override bool? EnableRouteParseCompileCache => true;
|
||||
protected override bool EnableHintRoute => true;
|
||||
|
||||
public override bool AutoCreateTableByTime()
|
||||
|
|
|
@ -11,7 +11,7 @@ namespace ShardingCore.Test.Shardings
|
|||
{
|
||||
public class LogWeekTimeLongVirtualTableRoute : AbstractSimpleShardingWeekKeyLongVirtualTableRoute<LogWeekTimeLong>
|
||||
{
|
||||
public override bool? EnableRouteParseCompileCache => true;
|
||||
//public override bool? EnableRouteParseCompileCache => true;
|
||||
protected override bool EnableHintRoute => true;
|
||||
|
||||
public override bool AutoCreateTableByTime()
|
||||
|
|
|
@ -11,7 +11,7 @@ namespace ShardingCore.Test.Shardings
|
|||
{
|
||||
public class LogYearDateTimeVirtualRoute:AbstractSimpleShardingYearKeyDateTimeVirtualTableRoute<LogYearDateTime>
|
||||
{
|
||||
public override bool? EnableRouteParseCompileCache => true;
|
||||
//public override bool? EnableRouteParseCompileCache => true;
|
||||
protected override bool EnableHintRoute => true;
|
||||
|
||||
public override bool AutoCreateTableByTime()
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace ShardingCore.Test.Shardings
|
|||
{
|
||||
public class LogYearLongVirtualRoute:AbstractSimpleShardingYearKeyLongVirtualTableRoute<LogYearLong>
|
||||
{
|
||||
public override bool? EnableRouteParseCompileCache => true;
|
||||
//public override bool? EnableRouteParseCompileCache => true;
|
||||
protected override bool EnableHintRoute => true;
|
||||
|
||||
public override void Configure(EntityMetadataTableBuilder<LogYearLong> builder)
|
||||
|
|
|
@ -11,7 +11,7 @@ namespace ShardingCore.Test.Shardings
|
|||
{
|
||||
public class OrderAreaShardingVirtualDataSourceRoute:AbstractShardingOperatorVirtualDataSourceRoute<Order,string>
|
||||
{
|
||||
public override bool? EnableRouteParseCompileCache => true;
|
||||
//public override bool? EnableRouteParseCompileCache => true;
|
||||
protected override bool EnableHintRoute =>true;
|
||||
|
||||
private readonly List<string> _dataSources = new List<string>()
|
||||
|
|
|
@ -9,7 +9,7 @@ namespace ShardingCore.Test.Shardings
|
|||
{
|
||||
public class OrderCreateTimeVirtualTableRoute:AbstractSimpleShardingMonthKeyDateTimeVirtualTableRoute<Order>
|
||||
{
|
||||
public override bool? EnableRouteParseCompileCache => true;
|
||||
//public override bool? EnableRouteParseCompileCache => true;
|
||||
public override DateTime GetBeginTime()
|
||||
{
|
||||
return new DateTime(2021, 1, 1);
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace ShardingCore.Test.Shardings
|
|||
public class SysUserModIntVirtualRoute:AbstractSimpleShardingModKeyIntVirtualTableRoute<SysUserModInt>
|
||||
{
|
||||
protected override bool EnableHintRoute => true;
|
||||
public override bool? EnableRouteParseCompileCache => true;
|
||||
//public override bool? EnableRouteParseCompileCache => true;
|
||||
|
||||
public SysUserModIntVirtualRoute() : base(2, 3)
|
||||
{
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace ShardingCore.Test.Shardings
|
|||
public class SysUserModVirtualTableRoute : AbstractSimpleShardingModKeyStringVirtualTableRoute<SysUserMod>
|
||||
{
|
||||
protected override bool EnableHintRoute => true;
|
||||
public override bool? EnableRouteParseCompileCache => true;
|
||||
//public override bool? EnableRouteParseCompileCache => true;
|
||||
|
||||
public SysUserModVirtualTableRoute() : base(2,3)
|
||||
{
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace ShardingCore.Test.Shardings
|
|||
*/
|
||||
public class SysUserSalaryVirtualTableRoute:AbstractShardingOperatorVirtualTableRoute<SysUserSalary,int>
|
||||
{
|
||||
public override bool? EnableRouteParseCompileCache => true;
|
||||
//public override bool? EnableRouteParseCompileCache => true;
|
||||
|
||||
public override string ShardingKeyToTail(object shardingKey)
|
||||
{
|
||||
|
|
|
@ -10,7 +10,7 @@ namespace ShardingCore.Test2x.Shardings
|
|||
public class LogDayLongVirtualRoute:AbstractSimpleShardingDayKeyLongVirtualTableRoute<LogDayLong>
|
||||
{
|
||||
protected override bool EnableHintRoute => true;
|
||||
public override bool? EnableRouteParseCompileCache => true;
|
||||
////public override bool? EnableRouteParseCompileCache => true;
|
||||
|
||||
public override void Configure(EntityMetadataTableBuilder<LogDayLong> builder)
|
||||
{
|
||||
|
|
|
@ -11,7 +11,7 @@ namespace ShardingCore.Test2x.Shardings
|
|||
public class LogDayVirtualTableRoute:AbstractSimpleShardingDayKeyDateTimeVirtualTableRoute<LogDay>
|
||||
{
|
||||
protected override bool EnableHintRoute => true;
|
||||
public override bool? EnableRouteParseCompileCache => true;
|
||||
//public override bool? EnableRouteParseCompileCache => true;
|
||||
|
||||
public override DateTime GetBeginTime()
|
||||
{
|
||||
|
|
|
@ -8,7 +8,7 @@ namespace ShardingCore.Test2x.Shardings
|
|||
public class LogMonthLongvirtualRoute:AbstractSimpleShardingMonthKeyLongVirtualTableRoute<LogMonthLong>
|
||||
{
|
||||
protected override bool EnableHintRoute => true;
|
||||
public override bool? EnableRouteParseCompileCache => true;
|
||||
//public override bool? EnableRouteParseCompileCache => true;
|
||||
|
||||
public override bool AutoCreateTableByTime()
|
||||
{
|
||||
|
|
|
@ -8,7 +8,7 @@ namespace ShardingCore.Test2x.Shardings
|
|||
public class LogWeekDateTimeVirtualTableRoute:AbstractSimpleShardingWeekKeyDateTimeVirtualTableRoute<LogWeekDateTime>
|
||||
{
|
||||
protected override bool EnableHintRoute => true;
|
||||
public override bool? EnableRouteParseCompileCache => true;
|
||||
//public override bool? EnableRouteParseCompileCache => true;
|
||||
|
||||
public override bool AutoCreateTableByTime()
|
||||
{
|
||||
|
|
|
@ -8,7 +8,7 @@ namespace ShardingCore.Test2x.Shardings
|
|||
public class LogWeekTimeLongVirtualTableRoute : AbstractSimpleShardingWeekKeyLongVirtualTableRoute<LogWeekTimeLong>
|
||||
{
|
||||
protected override bool EnableHintRoute => true;
|
||||
public override bool? EnableRouteParseCompileCache => true;
|
||||
//public override bool? EnableRouteParseCompileCache => true;
|
||||
|
||||
public override bool AutoCreateTableByTime()
|
||||
{
|
||||
|
|
|
@ -8,7 +8,7 @@ namespace ShardingCore.Test2x.Shardings
|
|||
public class LogYearDateTimeVirtualRoute:AbstractSimpleShardingYearKeyDateTimeVirtualTableRoute<LogYearDateTime>
|
||||
{
|
||||
protected override bool EnableHintRoute => true;
|
||||
public override bool? EnableRouteParseCompileCache => true;
|
||||
//public override bool? EnableRouteParseCompileCache => true;
|
||||
|
||||
public override bool AutoCreateTableByTime()
|
||||
{
|
||||
|
|
|
@ -8,7 +8,7 @@ namespace ShardingCore.Test2x.Shardings
|
|||
public class LogYearLongVirtualRoute:AbstractSimpleShardingYearKeyLongVirtualTableRoute<LogYearLong>
|
||||
{
|
||||
protected override bool EnableHintRoute => true;
|
||||
public override bool? EnableRouteParseCompileCache => true;
|
||||
//public override bool? EnableRouteParseCompileCache => true;
|
||||
|
||||
public override void Configure(EntityMetadataTableBuilder<LogYearLong> builder)
|
||||
{
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace ShardingCore.Test2x.Shardings
|
|||
public class OrderAreaShardingVirtualDataSourceRoute:AbstractShardingOperatorVirtualDataSourceRoute<Order,string>
|
||||
{
|
||||
protected override bool EnableHintRoute =>true;
|
||||
public override bool? EnableRouteParseCompileCache => true;
|
||||
//public override bool? EnableRouteParseCompileCache => true;
|
||||
|
||||
private readonly List<string> _dataSources = new List<string>()
|
||||
{
|
||||
|
|
|
@ -9,7 +9,7 @@ namespace ShardingCore.Test2x.Shardings
|
|||
{
|
||||
public class OrderCreateTimeVirtualTableRoute:AbstractSimpleShardingMonthKeyDateTimeVirtualTableRoute<Order>
|
||||
{
|
||||
public override bool? EnableRouteParseCompileCache => true;
|
||||
//public override bool? EnableRouteParseCompileCache => true;
|
||||
public override DateTime GetBeginTime()
|
||||
{
|
||||
return new DateTime(2021, 1, 1);
|
||||
|
|
|
@ -7,7 +7,7 @@ namespace ShardingCore.Test2x.Shardings
|
|||
public class SysUserModIntVirtualRoute:AbstractSimpleShardingModKeyIntVirtualTableRoute<SysUserModInt>
|
||||
{
|
||||
protected override bool EnableHintRoute => true;
|
||||
public override bool? EnableRouteParseCompileCache => true;
|
||||
//public override bool? EnableRouteParseCompileCache => true;
|
||||
|
||||
public SysUserModIntVirtualRoute() : base(2, 3)
|
||||
{
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace ShardingCore.Test2x.Shardings
|
|||
public class SysUserModVirtualTableRoute : AbstractSimpleShardingModKeyStringVirtualTableRoute<SysUserMod>
|
||||
{
|
||||
protected override bool EnableHintRoute => true;
|
||||
public override bool? EnableRouteParseCompileCache => true;
|
||||
//public override bool? EnableRouteParseCompileCache => true;
|
||||
|
||||
public SysUserModVirtualTableRoute() : base(2,3)
|
||||
{
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace ShardingCore.Test2x.Shardings
|
|||
*/
|
||||
public class SysUserSalaryVirtualTableRoute:AbstractShardingOperatorVirtualTableRoute<SysUserSalary,int>
|
||||
{
|
||||
public override bool? EnableRouteParseCompileCache => true;
|
||||
//public override bool? EnableRouteParseCompileCache => true;
|
||||
public override string ShardingKeyToTail(object shardingKey)
|
||||
{
|
||||
var time = Convert.ToInt32(shardingKey);
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace ShardingCore.Test3x.Shardings
|
|||
public class LogDayLongVirtualRoute:AbstractSimpleShardingDayKeyLongVirtualTableRoute<LogDayLong>
|
||||
{
|
||||
protected override bool EnableHintRoute => true;
|
||||
public override bool? EnableRouteParseCompileCache => true;
|
||||
//public override bool? EnableRouteParseCompileCache => true;
|
||||
|
||||
public override void Configure(EntityMetadataTableBuilder<LogDayLong> builder)
|
||||
{
|
||||
|
|
|
@ -11,7 +11,7 @@ namespace ShardingCore.Test3x.Shardings
|
|||
public class LogDayVirtualTableRoute:AbstractSimpleShardingDayKeyDateTimeVirtualTableRoute<LogDay>
|
||||
{
|
||||
protected override bool EnableHintRoute => true;
|
||||
public override bool? EnableRouteParseCompileCache => true;
|
||||
//public override bool? EnableRouteParseCompileCache => true;
|
||||
|
||||
public override DateTime GetBeginTime()
|
||||
{
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace ShardingCore.Test3x.Shardings
|
|||
public class LogMonthLongvirtualRoute:AbstractSimpleShardingMonthKeyLongVirtualTableRoute<LogMonthLong>
|
||||
{
|
||||
protected override bool EnableHintRoute => true;
|
||||
public override bool? EnableRouteParseCompileCache => true;
|
||||
//public override bool? EnableRouteParseCompileCache => true;
|
||||
|
||||
public override bool AutoCreateTableByTime()
|
||||
{
|
||||
|
|
|
@ -8,7 +8,7 @@ namespace ShardingCore.Test3x.Shardings
|
|||
public class LogWeekDateTimeVirtualTableRoute:AbstractSimpleShardingWeekKeyDateTimeVirtualTableRoute<LogWeekDateTime>
|
||||
{
|
||||
protected override bool EnableHintRoute => true;
|
||||
public override bool? EnableRouteParseCompileCache => true;
|
||||
//public override bool? EnableRouteParseCompileCache => true;
|
||||
|
||||
public override bool AutoCreateTableByTime()
|
||||
{
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace ShardingCore.Test3x.Shardings
|
|||
public class LogWeekTimeLongVirtualTableRoute : AbstractSimpleShardingWeekKeyLongVirtualTableRoute<LogWeekTimeLong>
|
||||
{
|
||||
protected override bool EnableHintRoute => true;
|
||||
public override bool? EnableRouteParseCompileCache => true;
|
||||
//public override bool? EnableRouteParseCompileCache => true;
|
||||
|
||||
public override bool AutoCreateTableByTime()
|
||||
{
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace ShardingCore.Test3x.Shardings
|
|||
public class LogYearDateTimeVirtualRoute:AbstractSimpleShardingYearKeyDateTimeVirtualTableRoute<LogYearDateTime>
|
||||
{
|
||||
protected override bool EnableHintRoute => true;
|
||||
public override bool? EnableRouteParseCompileCache => true;
|
||||
//public override bool? EnableRouteParseCompileCache => true;
|
||||
|
||||
public override bool AutoCreateTableByTime()
|
||||
{
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace ShardingCore.Test3x.Shardings
|
|||
public class LogYearLongVirtualRoute:AbstractSimpleShardingYearKeyLongVirtualTableRoute<LogYearLong>
|
||||
{
|
||||
protected override bool EnableHintRoute => true;
|
||||
public override bool? EnableRouteParseCompileCache => true;
|
||||
//public override bool? EnableRouteParseCompileCache => true;
|
||||
|
||||
public override void Configure(EntityMetadataTableBuilder<LogYearLong> builder)
|
||||
{
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace ShardingCore.Test3x.Shardings
|
|||
public class OrderAreaShardingVirtualDataSourceRoute:AbstractShardingOperatorVirtualDataSourceRoute<Order,string>
|
||||
{
|
||||
protected override bool EnableHintRoute =>true;
|
||||
public override bool? EnableRouteParseCompileCache => true;
|
||||
//public override bool? EnableRouteParseCompileCache => true;
|
||||
|
||||
private readonly List<string> _dataSources = new List<string>()
|
||||
{
|
||||
|
|
|
@ -9,7 +9,7 @@ namespace ShardingCore.Test3x.Shardings
|
|||
{
|
||||
public class OrderCreateTimeVirtualTableRoute:AbstractSimpleShardingMonthKeyDateTimeVirtualTableRoute<Order>
|
||||
{
|
||||
public override bool? EnableRouteParseCompileCache => true;
|
||||
//public override bool? EnableRouteParseCompileCache => true;
|
||||
public override DateTime GetBeginTime()
|
||||
{
|
||||
return new DateTime(2021, 1, 1);
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace ShardingCore.Test3x.Shardings
|
|||
{
|
||||
protected override bool EnableHintRoute => true;
|
||||
|
||||
public override bool? EnableRouteParseCompileCache => true;
|
||||
//public override bool? EnableRouteParseCompileCache => true;
|
||||
public SysUserModIntVirtualRoute() : base(2, 3)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace ShardingCore.Test3x.Shardings
|
|||
public class SysUserModVirtualTableRoute : AbstractSimpleShardingModKeyStringVirtualTableRoute<SysUserMod>
|
||||
{
|
||||
protected override bool EnableHintRoute => true;
|
||||
public override bool? EnableRouteParseCompileCache => true;
|
||||
//public override bool? EnableRouteParseCompileCache => true;
|
||||
|
||||
public SysUserModVirtualTableRoute() : base(2,3)
|
||||
{
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace ShardingCore.Test3x.Shardings
|
|||
public class SysUserSalaryVirtualTableRoute:AbstractShardingOperatorVirtualTableRoute<SysUserSalary,int>
|
||||
{
|
||||
|
||||
public override bool? EnableRouteParseCompileCache => true;
|
||||
//public override bool? EnableRouteParseCompileCache => true;
|
||||
public override string ShardingKeyToTail(object shardingKey)
|
||||
{
|
||||
var time = Convert.ToInt32(shardingKey);
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace ShardingCore.Test5x.Shardings
|
|||
public class LogDayLongVirtualRoute:AbstractSimpleShardingDayKeyLongVirtualTableRoute<LogDayLong>
|
||||
{
|
||||
protected override bool EnableHintRoute => true;
|
||||
public override bool? EnableRouteParseCompileCache => true;
|
||||
//public override bool? EnableRouteParseCompileCache => true;
|
||||
|
||||
public override void Configure(EntityMetadataTableBuilder<LogDayLong> builder)
|
||||
{
|
||||
|
|
|
@ -11,7 +11,7 @@ namespace ShardingCore.Test5x.Shardings
|
|||
public class LogDayVirtualTableRoute:AbstractSimpleShardingDayKeyDateTimeVirtualTableRoute<LogDay>
|
||||
{
|
||||
protected override bool EnableHintRoute => true;
|
||||
public override bool? EnableRouteParseCompileCache => true;
|
||||
//public override bool? EnableRouteParseCompileCache => true;
|
||||
|
||||
public override DateTime GetBeginTime()
|
||||
{
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace ShardingCore.Test5x.Shardings
|
|||
public class LogMonthLongvirtualRoute:AbstractSimpleShardingMonthKeyLongVirtualTableRoute<LogMonthLong>
|
||||
{
|
||||
protected override bool EnableHintRoute => true;
|
||||
public override bool? EnableRouteParseCompileCache => true;
|
||||
//public override bool? EnableRouteParseCompileCache => true;
|
||||
|
||||
public override bool AutoCreateTableByTime()
|
||||
{
|
||||
|
|
|
@ -8,7 +8,7 @@ namespace ShardingCore.Test5x.Shardings
|
|||
public class LogWeekDateTimeVirtualTableRoute:AbstractSimpleShardingWeekKeyDateTimeVirtualTableRoute<LogWeekDateTime>
|
||||
{
|
||||
protected override bool EnableHintRoute => true;
|
||||
public override bool? EnableRouteParseCompileCache => true;
|
||||
//public override bool? EnableRouteParseCompileCache => true;
|
||||
|
||||
public override bool AutoCreateTableByTime()
|
||||
{
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace ShardingCore.Test5x.Shardings
|
|||
public class LogWeekTimeLongVirtualTableRoute : AbstractSimpleShardingWeekKeyLongVirtualTableRoute<LogWeekTimeLong>
|
||||
{
|
||||
protected override bool EnableHintRoute => true;
|
||||
public override bool? EnableRouteParseCompileCache => true;
|
||||
//public override bool? EnableRouteParseCompileCache => true;
|
||||
|
||||
public override bool AutoCreateTableByTime()
|
||||
{
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace ShardingCore.Test5x.Shardings
|
|||
public class LogYearDateTimeVirtualRoute:AbstractSimpleShardingYearKeyDateTimeVirtualTableRoute<LogYearDateTime>
|
||||
{
|
||||
protected override bool EnableHintRoute => true;
|
||||
public override bool? EnableRouteParseCompileCache => true;
|
||||
//public override bool? EnableRouteParseCompileCache => true;
|
||||
|
||||
public override bool AutoCreateTableByTime()
|
||||
{
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace ShardingCore.Test5x.Shardings
|
|||
public class LogYearLongVirtualRoute:AbstractSimpleShardingYearKeyLongVirtualTableRoute<LogYearLong>
|
||||
{
|
||||
protected override bool EnableHintRoute => true;
|
||||
public override bool? EnableRouteParseCompileCache => true;
|
||||
//public override bool? EnableRouteParseCompileCache => true;
|
||||
|
||||
public override void Configure(EntityMetadataTableBuilder<LogYearLong> builder)
|
||||
{
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace ShardingCore.Test5x.Shardings
|
|||
public class OrderAreaShardingVirtualDataSourceRoute:AbstractShardingOperatorVirtualDataSourceRoute<Order,string>
|
||||
{
|
||||
protected override bool EnableHintRoute =>true;
|
||||
public override bool? EnableRouteParseCompileCache => true;
|
||||
//public override bool? EnableRouteParseCompileCache => true;
|
||||
|
||||
private readonly List<string> _dataSources = new List<string>()
|
||||
{
|
||||
|
|
|
@ -9,7 +9,7 @@ namespace ShardingCore.Test5x.Shardings
|
|||
{
|
||||
public class OrderCreateTimeVirtualTableRoute:AbstractSimpleShardingMonthKeyDateTimeVirtualTableRoute<Order>
|
||||
{
|
||||
public override bool? EnableRouteParseCompileCache => true;
|
||||
//public override bool? EnableRouteParseCompileCache => true;
|
||||
public override DateTime GetBeginTime()
|
||||
{
|
||||
return new DateTime(2021, 1, 1);
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace ShardingCore.Test5x.Shardings
|
|||
public class SysUserModIntVirtualRoute:AbstractSimpleShardingModKeyIntVirtualTableRoute<SysUserModInt>
|
||||
{
|
||||
protected override bool EnableHintRoute => true;
|
||||
public override bool? EnableRouteParseCompileCache => true;
|
||||
//public override bool? EnableRouteParseCompileCache => true;
|
||||
|
||||
public SysUserModIntVirtualRoute() : base(2, 3)
|
||||
{
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace ShardingCore.Test5x.Shardings
|
|||
public class SysUserModVirtualTableRoute : AbstractSimpleShardingModKeyStringVirtualTableRoute<SysUserMod>
|
||||
{
|
||||
protected override bool EnableHintRoute => true;
|
||||
public override bool? EnableRouteParseCompileCache => true;
|
||||
//public override bool? EnableRouteParseCompileCache => true;
|
||||
|
||||
public SysUserModVirtualTableRoute() : base(2,3)
|
||||
{
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace ShardingCore.Test5x.Shardings
|
|||
*/
|
||||
public class SysUserSalaryVirtualTableRoute:AbstractShardingOperatorVirtualTableRoute<SysUserSalary,int>
|
||||
{
|
||||
public override bool? EnableRouteParseCompileCache => true;
|
||||
//public override bool? EnableRouteParseCompileCache => true;
|
||||
public override string ShardingKeyToTail(object shardingKey)
|
||||
{
|
||||
var time = Convert.ToInt32(shardingKey);
|
||||
|
|
Loading…
Reference in New Issue