移除必要的代码tablemanager和datasourcemanager
This commit is contained in:
parent
d198d46cbc
commit
5fb2852db4
|
@ -3,6 +3,7 @@ using Sample.MySql.DbContexts;
|
|||
using Sample.MySql.Shardings;
|
||||
using ShardingCore;
|
||||
using ShardingCore.Core;
|
||||
using ShardingCore.Core.RuntimeContexts;
|
||||
using ShardingCore.Extensions;
|
||||
|
||||
namespace Sample.MySql
|
||||
|
|
|
@ -14,6 +14,7 @@ using System.Threading.Tasks;
|
|||
using ShardingCore.Core.VirtualRoutes.TableRoutes;
|
||||
using ShardingCore.Extensions.ShardingQueryableExtensions;
|
||||
using ShardingCore.Core;
|
||||
using ShardingCore.Core.RuntimeContexts;
|
||||
using ShardingCore.Sharding.ReadWriteConfigurations.Abstractions;
|
||||
|
||||
namespace Sample.SqlServer.Controllers
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
using Sample.SqlServer.DbContexts;
|
||||
using ShardingCore;
|
||||
using ShardingCore.Core;
|
||||
using ShardingCore.Core.RuntimeContexts;
|
||||
|
||||
namespace Sample.SqlServer
|
||||
{
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace ShardingCore.Core
|
|||
[ExcludeFromCodeCoverage]
|
||||
private Check(){}
|
||||
/// <summary>
|
||||
/// 不能为空
|
||||
/// 不能为空
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="value"></param>
|
||||
|
@ -28,7 +28,7 @@ namespace ShardingCore.Core
|
|||
return value;
|
||||
}
|
||||
/// <summary>
|
||||
/// 应该为空
|
||||
/// 应该为空
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="value"></param>
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
namespace ShardingCore.Core
|
||||
{
|
||||
public interface IShardingRuntimeContextFactory
|
||||
{
|
||||
IShardingRuntimeContext Create();
|
||||
}
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace ShardingCore.Core
|
||||
{
|
||||
|
||||
public interface IShardingRuntimeModel
|
||||
{
|
||||
IShardingEntityType GetShardingEntityType(Type entityType);
|
||||
List<IShardingEntityType> GetShardingEntityTypes();
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace ShardingCore.Core
|
||||
{
|
||||
public interface IShardingRuntimeModelCacheFactory
|
||||
{
|
||||
object GetCacheKey<TDbContext>();
|
||||
object GetCacheKey(Type DbContext);
|
||||
}
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
namespace ShardingCore.Core
|
||||
{
|
||||
|
||||
public interface IShardingRuntimeModelOptions
|
||||
{
|
||||
|
||||
}
|
||||
}
|
|
@ -1,97 +0,0 @@
|
|||
// using System;
|
||||
// using ShardingCore.Core.EntityMetadatas;
|
||||
// using ShardingCore.Core.VirtualTables;
|
||||
//
|
||||
// namespace ShardingCore.Core.PhysicTables
|
||||
// {
|
||||
// /*
|
||||
// * @Author: xjm
|
||||
// * @Description:
|
||||
// * @Date: Friday, 18 December 2020 13:57:50
|
||||
// * @Email: 326308290@qq.com
|
||||
// */
|
||||
// /// <summary>
|
||||
// /// 默认的物理表
|
||||
// /// </summary>
|
||||
// public class DefaultPhysicTable : IPhysicTable
|
||||
// {
|
||||
// /// <summary>
|
||||
// /// 物理表
|
||||
// /// </summary>
|
||||
// /// <param name="virtualTable">虚拟表</param>
|
||||
// /// <param name="tail">物理表表后缀</param>
|
||||
// public DefaultPhysicTable(IVirtualTable virtualTable, string tail)
|
||||
// {
|
||||
// VirtualTable = virtualTable;
|
||||
// // OriginalName = virtualTable.GetVirtualTableName();
|
||||
// Tail = tail;
|
||||
// EntityMetadata = VirtualTable.EntityMetadata;
|
||||
// EntityType = EntityMetadata.EntityType;
|
||||
// TableSeparator = EntityMetadata.TableSeparator;
|
||||
// }
|
||||
//
|
||||
// /// <summary>
|
||||
// /// 元数据对象
|
||||
// /// </summary>
|
||||
// public EntityMetadata EntityMetadata { get; }
|
||||
// // /// <summary>
|
||||
// // /// 全表名称
|
||||
// // /// </summary>
|
||||
// // public string FullName => $"{OriginalName}{TableSeparator}{Tail}";
|
||||
// // /// <summary>
|
||||
// // /// 原始表名
|
||||
// // /// </summary>
|
||||
// // public string OriginalName { get; }
|
||||
// /// <summary>
|
||||
// /// 分表的表名和后置的连接器默认为下划线"_" 可以为空
|
||||
// /// </summary>
|
||||
// public string TableSeparator { get; }
|
||||
// /// <summary>
|
||||
// /// 分表后缀
|
||||
// /// </summary>
|
||||
// public string Tail { get; }
|
||||
// /// <summary>
|
||||
// /// 类型对象
|
||||
// /// </summary>
|
||||
// public Type EntityType { get; }
|
||||
// /// <summary>
|
||||
// /// 所属虚拟表
|
||||
// /// </summary>
|
||||
// public IVirtualTable VirtualTable { get; }
|
||||
// protected bool Equals(DefaultPhysicTable other)
|
||||
// {
|
||||
// return Tail == other.Tail && EntityType == other.EntityType;
|
||||
// }
|
||||
//
|
||||
// public override bool Equals(object obj)
|
||||
// {
|
||||
// if (ReferenceEquals(null, obj)) return false;
|
||||
// if (ReferenceEquals(this, obj)) return true;
|
||||
// if (obj.GetType() != this.GetType()) return false;
|
||||
// return Equals((DefaultPhysicTable)obj);
|
||||
// }
|
||||
//
|
||||
// #if !EFCORE2
|
||||
//
|
||||
// public override int GetHashCode()
|
||||
// {
|
||||
// return HashCode.Combine(TableSeparator, Tail, VirtualTable);
|
||||
// }
|
||||
// #endif
|
||||
//
|
||||
// #if EFCORE2
|
||||
//
|
||||
// public override int GetHashCode()
|
||||
// {
|
||||
// unchecked
|
||||
// {
|
||||
// var hashCode = (TableSeparator != null ? TableSeparator.GetHashCode() : 0);
|
||||
// hashCode = (hashCode * 397) ^ (Tail != null ? Tail.GetHashCode() : 0);
|
||||
// hashCode = (hashCode * 397) ^ (VirtualTable != null ? VirtualTable.GetHashCode() : 0);
|
||||
// return hashCode;
|
||||
// }
|
||||
// }
|
||||
// #endif
|
||||
//
|
||||
// }
|
||||
// }
|
|
@ -1,48 +0,0 @@
|
|||
// using System;
|
||||
// using ShardingCore.Core.EntityMetadatas;
|
||||
// using ShardingCore.Core.VirtualTables;
|
||||
//
|
||||
// /*
|
||||
// * @Author: xjm
|
||||
// * @Description:
|
||||
// * @Date: Friday, 18 December 2020 13:54:46
|
||||
// * @Email: 326308290@qq.com
|
||||
// */
|
||||
// namespace ShardingCore.Core.PhysicTables
|
||||
// {
|
||||
// /// <summary>
|
||||
// /// 物理表接口
|
||||
// /// </summary>
|
||||
// public interface IPhysicTable
|
||||
// {
|
||||
// /// <summary>
|
||||
// /// 对象信息
|
||||
// /// </summary>
|
||||
// EntityMetadata EntityMetadata { get; }
|
||||
// // /// <summary>
|
||||
// // /// 表全称
|
||||
// // /// </summary>
|
||||
// // string FullName { get; }
|
||||
// // /// <summary>
|
||||
// // /// 原表名称
|
||||
// // /// </summary>
|
||||
// // string OriginalName { get; }
|
||||
// /// <summary>
|
||||
// /// 尾巴前缀 tail prefix
|
||||
// /// </summary>
|
||||
// string TableSeparator { get; }
|
||||
// /// <summary>
|
||||
// /// 尾巴
|
||||
// /// </summary>
|
||||
// string Tail { get; }
|
||||
// /// <summary>
|
||||
// /// 映射类类型
|
||||
// /// </summary>
|
||||
// Type EntityType { get; }
|
||||
// /// <summary>
|
||||
// /// 所属虚拟表
|
||||
// /// </summary>
|
||||
// IVirtualTable VirtualTable { get; }
|
||||
//
|
||||
// }
|
||||
// }
|
|
@ -16,7 +16,7 @@ namespace ShardingCore.Core.QueryRouteManagers.Abstractions
|
|||
/// </summary>
|
||||
public interface ITableRouteAssert
|
||||
{
|
||||
void Assert(DataSourceRouteResult dataSourceRouteResult,List<string> tails, List<ShardingRouteUnit> shardingRouteUnits);
|
||||
void Assert(DataSourceRouteResult dataSourceRouteResult,List<string> tails, List<TableRouteUnit> shardingRouteUnits);
|
||||
}
|
||||
|
||||
public interface ITableRouteAssert<T> : ITableRouteAssert where T : class
|
||||
|
|
|
@ -8,14 +8,13 @@ using ShardingCore.Core.ShardingPage.Abstractions;
|
|||
using ShardingCore.Core.TrackerManagers;
|
||||
using ShardingCore.Core.UnionAllMergeShardingProviders.Abstractions;
|
||||
using ShardingCore.Core.VirtualDatabase.VirtualDataSources;
|
||||
using ShardingCore.Core.VirtualDatabase.VirtualDataSources.Abstractions;
|
||||
using ShardingCore.Core.VirtualRoutes.Abstractions;
|
||||
using ShardingCore.Core.VirtualRoutes.TableRoutes.RouteTails.Abstractions;
|
||||
using ShardingCore.Sharding.Abstractions;
|
||||
using ShardingCore.Sharding.ParallelTables;
|
||||
using ShardingCore.Sharding.ReadWriteConfigurations.Abstractions;
|
||||
|
||||
namespace ShardingCore.Core
|
||||
namespace ShardingCore.Core.RuntimeContexts
|
||||
{
|
||||
|
||||
public interface IShardingRuntimeContext
|
|
@ -1,7 +1,4 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
@ -10,23 +7,18 @@ using ShardingCore.Core.DbContextCreator;
|
|||
using ShardingCore.Core.EntityMetadatas;
|
||||
using ShardingCore.Core.QueryRouteManagers.Abstractions;
|
||||
using ShardingCore.Core.QueryTrackers;
|
||||
using ShardingCore.Core.ShardingConfigurations.Abstractions;
|
||||
using ShardingCore.Core.ShardingPage.Abstractions;
|
||||
using ShardingCore.Core.TrackerManagers;
|
||||
using ShardingCore.Core.UnionAllMergeShardingProviders.Abstractions;
|
||||
using ShardingCore.Core.VirtualDatabase.VirtualDataSources;
|
||||
using ShardingCore.Core.VirtualRoutes.Abstractions;
|
||||
using ShardingCore.Core.VirtualRoutes.TableRoutes.RouteTails.Abstractions;
|
||||
using ShardingCore.Exceptions;
|
||||
using ShardingCore.Extensions;
|
||||
using ShardingCore.Logger;
|
||||
using ShardingCore.Sharding.Abstractions;
|
||||
using ShardingCore.Sharding.MergeEngines.ParallelControl;
|
||||
using ShardingCore.Sharding.ParallelTables;
|
||||
using ShardingCore.Sharding.ReadWriteConfigurations.Abstractions;
|
||||
|
||||
|
||||
namespace ShardingCore.Core
|
||||
namespace ShardingCore.Core.RuntimeContexts
|
||||
{
|
||||
public sealed class ShardingRuntimeContext:IShardingRuntimeContext
|
||||
{
|
|
@ -1,12 +0,0 @@
|
|||
// using Microsoft.EntityFrameworkCore;
|
||||
// using ShardingCore.Sharding.Abstractions;
|
||||
//
|
||||
// namespace ShardingCore.Core.ShardingConfigurations.Abstractions
|
||||
// {
|
||||
// public interface IShardingConfigurationOptions
|
||||
// {
|
||||
// public void AddShardingGlobalConfigOptions(ShardingConfigOptions shardingConfigOptions);
|
||||
//
|
||||
// public ShardingConfigOptions[] GetAllShardingGlobalConfigOptions();
|
||||
// }
|
||||
// }
|
|
@ -1,160 +0,0 @@
|
|||
// using System;
|
||||
// using System.Collections.Generic;
|
||||
// using System.Linq;
|
||||
// using System.Text;
|
||||
// using System.Threading.Tasks;
|
||||
// using Microsoft.EntityFrameworkCore;
|
||||
// using Microsoft.Extensions.DependencyInjection;
|
||||
// using Microsoft.Extensions.DependencyInjection.Extensions;
|
||||
// using ShardingCore.Core.ShardingConfigurations.Abstractions;
|
||||
// using ShardingCore.Core.VirtualDatabase.VirtualDataSources.Common;
|
||||
// using ShardingCore.DIExtensions;
|
||||
// using ShardingCore.Exceptions;
|
||||
// using ShardingCore.Extensions;
|
||||
// using ShardingCore.Sharding;
|
||||
// using ShardingCore.Sharding.Abstractions;
|
||||
// using ShardingCore.Sharding.ReadWriteConfigurations;
|
||||
// using ShardingCore.Sharding.ReadWriteConfigurations.Abstractions;
|
||||
// using ShardingCore.Sharding.ShardingComparision.Abstractions;
|
||||
//
|
||||
// namespace ShardingCore.Core.ShardingConfigurations.ConfigBuilders
|
||||
// {
|
||||
// public class ShardingConfigBuilder<TShardingDbContext> where TShardingDbContext:DbContext,IShardingDbContext
|
||||
// {
|
||||
// public ShardingCoreConfigBuilder<TShardingDbContext> ShardingCoreConfigBuilder { get; }
|
||||
//
|
||||
// public ShardingConfigBuilder(ShardingCoreConfigBuilder<TShardingDbContext> shardingCoreConfigBuilder)
|
||||
// {
|
||||
// ShardingCoreConfigBuilder = shardingCoreConfigBuilder;
|
||||
// }
|
||||
// /// <summary>
|
||||
// /// 添加一个分片配置 必填<code>ConfigId</code>和<code>AddDefaultDataSource(string dataSourceName, string connectionString)</code>
|
||||
// /// 如果全局未配置 必须配置<code>UseShardingQuery</code>和<code>UseShardingQuery</code>
|
||||
// /// </summary>
|
||||
// /// <param name="shardingGlobalConfigOptionsConfigure"></param>
|
||||
// /// <returns></returns>
|
||||
// /// <exception cref="ArgumentNullException"></exception>
|
||||
// /// <exception cref="ShardingCoreConfigException"></exception>
|
||||
// /// <exception cref="ArgumentException"></exception>
|
||||
// public ShardingConfigBuilder<TShardingDbContext> AddConfig(Action<ShardingConfigOptions> shardingGlobalConfigOptionsConfigure)
|
||||
// {
|
||||
// var shardingGlobalConfigOptions = new ShardingConfigOptions();
|
||||
// shardingGlobalConfigOptionsConfigure?.Invoke(shardingGlobalConfigOptions);
|
||||
// if (string.IsNullOrWhiteSpace(shardingGlobalConfigOptions.ConfigId))
|
||||
// throw new ArgumentNullException(nameof(shardingGlobalConfigOptions.ConfigId));
|
||||
// if (string.IsNullOrWhiteSpace(shardingGlobalConfigOptions.DefaultDataSourceName))
|
||||
// throw new ArgumentNullException(
|
||||
// $"{nameof(shardingGlobalConfigOptions.DefaultDataSourceName)} plz call {nameof(ShardingConfigOptions.AddDefaultDataSource)}");
|
||||
//
|
||||
// if (string.IsNullOrWhiteSpace(shardingGlobalConfigOptions.DefaultConnectionString))
|
||||
// throw new ArgumentNullException(
|
||||
// $"{nameof(shardingGlobalConfigOptions.DefaultConnectionString)} plz call {nameof(ShardingConfigOptions.AddDefaultDataSource)}");
|
||||
//
|
||||
// if (shardingGlobalConfigOptions.ConnectionStringConfigure is null&& ShardingCoreConfigBuilder.ShardingRouteConfigOptions.ConnectionStringConfigure is null)
|
||||
// throw new ArgumentNullException($"plz call {nameof(shardingGlobalConfigOptions.UseShardingQuery)}");
|
||||
// if (shardingGlobalConfigOptions.ConnectionConfigure is null && ShardingCoreConfigBuilder.ShardingRouteConfigOptions.ConnectionConfigure is null)
|
||||
// throw new ArgumentNullException(
|
||||
// $"plz call {nameof(shardingGlobalConfigOptions.UseShardingTransaction)}");
|
||||
//
|
||||
// if (shardingGlobalConfigOptions.MaxQueryConnectionsLimit <= 0)
|
||||
// throw new ArgumentException(
|
||||
// $"{nameof(shardingGlobalConfigOptions.MaxQueryConnectionsLimit)} should greater than and equal 1");
|
||||
// ShardingCoreConfigBuilder.ShardingConfigOptions.Add(shardingGlobalConfigOptions);
|
||||
// return this;
|
||||
// }
|
||||
// /// <summary>
|
||||
// /// 单配置确认
|
||||
// /// </summary>
|
||||
// /// <param name="configurationStrategy"></param>
|
||||
// /// <returns></returns>
|
||||
// public IServiceCollection EnsureConfig(ShardingConfigurationStrategyEnum configurationStrategy = ShardingConfigurationStrategyEnum.ThrowIfNull)
|
||||
// {
|
||||
// return DoEnsureConfig(false,false, configurationStrategy);
|
||||
// }
|
||||
// /// <summary>
|
||||
// /// 单配置确认 自动初始化不需要在手动<code>IShardingBootstrapper.Start()</code>
|
||||
// /// </summary>
|
||||
// /// <param name="configurationStrategy"></param>
|
||||
// /// <returns></returns>
|
||||
// public IServiceCollection EnsureConfigWithAutoStart(ShardingConfigurationStrategyEnum configurationStrategy = ShardingConfigurationStrategyEnum.ThrowIfNull)
|
||||
// {
|
||||
// return DoEnsureConfig(false,true, configurationStrategy);
|
||||
// }
|
||||
// /// <summary>
|
||||
// /// 多配置确认
|
||||
// /// </summary>
|
||||
// /// <param name="configurationStrategy"></param>
|
||||
// /// <returns></returns>
|
||||
// public IServiceCollection EnsureMultiConfig(ShardingConfigurationStrategyEnum configurationStrategy= ShardingConfigurationStrategyEnum.ThrowIfNull)
|
||||
// {
|
||||
// return DoEnsureConfig(true,false, configurationStrategy);
|
||||
// }
|
||||
// /// <summary>
|
||||
// /// 多配置确认 自动初始化不需要在手动<code>IShardingBootstrapper.Start()</code>
|
||||
// /// </summary>
|
||||
// /// <param name="configurationStrategy"></param>
|
||||
// /// <returns></returns>
|
||||
// public IServiceCollection EnsureMultiConfigWithAutoStart(ShardingConfigurationStrategyEnum configurationStrategy= ShardingConfigurationStrategyEnum.ThrowIfNull)
|
||||
// {
|
||||
// return DoEnsureConfig(true,true, configurationStrategy);
|
||||
// }
|
||||
//
|
||||
// private IServiceCollection DoEnsureConfig(bool isMultiConfig,
|
||||
// bool autoStart,
|
||||
// ShardingConfigurationStrategyEnum configurationStrategy)
|
||||
// {
|
||||
// if (ShardingCoreConfigBuilder.ShardingConfigOptions.IsEmpty())
|
||||
// throw new ArgumentException($"plz call {nameof(AddConfig)} at least once ");
|
||||
// if (!isMultiConfig)
|
||||
// {
|
||||
// if (ShardingCoreConfigBuilder.ShardingConfigOptions.Count > 1)
|
||||
// {
|
||||
// throw new ArgumentException($"plz call {nameof(AddConfig)} at most once ");
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// var services = ShardingCoreConfigBuilder.Services;
|
||||
// services.AddSingleton<IDbContextTypeCollector>(sp => new DbContextTypeCollector<TShardingDbContext>());
|
||||
// services.AddSingleton<IShardingRouteConfigOptions>(sp => ShardingCoreConfigBuilder.ShardingRouteConfigOptions);
|
||||
// services.AddSingleton(sp => ShardingCoreConfigBuilder.ShardingRouteConfigOptions);
|
||||
//
|
||||
// services.AddSingleton(sp => CreateShardingConfigurationOptions(isMultiConfig, configurationStrategy));
|
||||
// services.AddSingleton<IShardingReadWriteAccessor, ShardingReadWriteAccessor<TShardingDbContext>>();
|
||||
// if (autoStart)
|
||||
// {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// services.AddInternalShardingCore<TShardingDbContext>();
|
||||
// return services;
|
||||
// }
|
||||
//
|
||||
// private IShardingConfigurationOptions CreateShardingConfigurationOptions(bool isMultiConfig,
|
||||
// ShardingConfigurationStrategyEnum configurationStrategy)
|
||||
// {
|
||||
// IShardingConfigurationOptions shardingConfigurationOptions;
|
||||
// if (!isMultiConfig)
|
||||
// {
|
||||
// shardingConfigurationOptions = new ShardingSingleConfigurationOptions
|
||||
// {
|
||||
// ShardingConfigurationStrategy = configurationStrategy
|
||||
// };
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// shardingConfigurationOptions = new ShardingMultiConfigurationOptions
|
||||
// {
|
||||
// ShardingConfigurationStrategy = configurationStrategy
|
||||
// };
|
||||
// }
|
||||
//
|
||||
// foreach (var configOptions in ShardingCoreConfigBuilder
|
||||
// .ShardingConfigOptions)
|
||||
// {
|
||||
// shardingConfigurationOptions.AddShardingGlobalConfigOptions(configOptions);
|
||||
// }
|
||||
//
|
||||
// return shardingConfigurationOptions;
|
||||
// }
|
||||
// }
|
||||
// }
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using ShardingCore.Core.RuntimeContexts;
|
||||
using ShardingCore.Core.ShardingConfigurations.Abstractions;
|
||||
using ShardingCore.Sharding.Abstractions;
|
||||
|
||||
|
|
|
@ -1,32 +0,0 @@
|
|||
// using Microsoft.EntityFrameworkCore;
|
||||
// using ShardingCore.Core.ShardingConfigurations.Abstractions;
|
||||
// using ShardingCore.Core.VirtualDatabase.VirtualDataSources.Common;
|
||||
// using ShardingCore.Exceptions;
|
||||
// using ShardingCore.Sharding.Abstractions;
|
||||
// using System.Collections.Generic;
|
||||
// using System.Linq;
|
||||
//
|
||||
// namespace ShardingCore.Core.ShardingConfigurations
|
||||
// {
|
||||
// public class ShardingMultiConfigurationOptions : IShardingConfigurationOptions
|
||||
// {
|
||||
// public ShardingConfigurationStrategyEnum ShardingConfigurationStrategy { get; set; } =
|
||||
// ShardingConfigurationStrategyEnum.ThrowIfNull;
|
||||
//
|
||||
// private Dictionary<string, ShardingConfigOptions> _shardingGlobalConfigOptions = new ();
|
||||
//
|
||||
// public void AddShardingGlobalConfigOptions(ShardingConfigOptions shardingConfigOptions)
|
||||
// {
|
||||
// if (_shardingGlobalConfigOptions.ContainsKey(shardingConfigOptions.ConfigId))
|
||||
// throw new ShardingCoreInvalidOperationException($"repeat add config id:[{shardingConfigOptions.ConfigId}]");
|
||||
//
|
||||
// _shardingGlobalConfigOptions.Add(shardingConfigOptions.ConfigId, shardingConfigOptions);
|
||||
// }
|
||||
//
|
||||
// public ShardingConfigOptions[] GetAllShardingGlobalConfigOptions()
|
||||
// {
|
||||
// return _shardingGlobalConfigOptions.Values.ToArray();
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// }
|
|
@ -1,28 +0,0 @@
|
|||
// using Microsoft.EntityFrameworkCore;
|
||||
// using ShardingCore.Core.ShardingConfigurations.Abstractions;
|
||||
// using ShardingCore.Core.VirtualDatabase.VirtualDataSources.Common;
|
||||
// using ShardingCore.Exceptions;
|
||||
// using ShardingCore.Sharding.Abstractions;
|
||||
//
|
||||
// namespace ShardingCore.Core.ShardingConfigurations
|
||||
// {
|
||||
// public class ShardingSingleConfigurationOptions : IShardingConfigurationOptions
|
||||
// {
|
||||
//
|
||||
// private ShardingConfigOptions _shardingConfigOptions;
|
||||
// public ShardingConfigurationStrategyEnum ShardingConfigurationStrategy { get; set; } =
|
||||
// ShardingConfigurationStrategyEnum.ThrowIfNull;
|
||||
//
|
||||
// public void AddShardingGlobalConfigOptions(ShardingConfigOptions shardingConfigOptions)
|
||||
// {
|
||||
// if (_shardingConfigOptions != null)
|
||||
// throw new ShardingCoreInvalidOperationException($"repeat add {nameof(ShardingConfigOptions)}");
|
||||
// _shardingConfigOptions= shardingConfigOptions;
|
||||
// }
|
||||
//
|
||||
// public ShardingConfigOptions[] GetAllShardingGlobalConfigOptions()
|
||||
// {
|
||||
// return new[] { _shardingConfigOptions };
|
||||
// }
|
||||
// }
|
||||
// }
|
|
@ -1,10 +0,0 @@
|
|||
using System;
|
||||
|
||||
namespace ShardingCore.Core.ShardingDatabaseProviders
|
||||
{
|
||||
|
||||
public interface IShardingDatabaseProvider
|
||||
{
|
||||
Type GetShardingDbContextType();
|
||||
}
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using ShardingCore.Sharding.Abstractions;
|
||||
|
||||
namespace ShardingCore.Core.ShardingDatabaseProviders
|
||||
{
|
||||
public class ShardingDatabaseProvider<TShardingDbContext> : IShardingDatabaseProvider
|
||||
where TShardingDbContext : DbContext, IShardingDbContext
|
||||
{
|
||||
private readonly Type _shardingDbContextType;
|
||||
|
||||
public ShardingDatabaseProvider()
|
||||
{
|
||||
_shardingDbContextType = typeof(TShardingDbContext);
|
||||
}
|
||||
|
||||
public Type GetShardingDbContextType()
|
||||
{
|
||||
return _shardingDbContextType;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
// using System;
|
||||
// using System.Collections.Generic;
|
||||
// using System.Linq;
|
||||
// using System.Text;
|
||||
// using System.Threading.Tasks;
|
||||
//
|
||||
// namespace ShardingCore.Core.VirtualDatabase.VirtualDataSources.Abstractions
|
||||
// {
|
||||
// public interface IVirtualDataSourceAccessor
|
||||
// {
|
||||
// VirtualDataSourceContext DataSourceContext { get; set; }
|
||||
// }
|
||||
// }
|
|
@ -1,32 +0,0 @@
|
|||
// using System;
|
||||
// using System.Collections.Generic;
|
||||
// using System.Linq;
|
||||
// using System.Text;
|
||||
// using System.Threading.Tasks;
|
||||
// using Microsoft.EntityFrameworkCore;
|
||||
// using ShardingCore.Core.ShardingConfigurations.Abstractions;
|
||||
// using ShardingCore.Core.VirtualDatabase.VirtualDataSources.Common;
|
||||
// using ShardingCore.Sharding.Abstractions;
|
||||
//
|
||||
// namespace ShardingCore.Core.VirtualDatabase.VirtualDataSources.Abstractions
|
||||
// {
|
||||
// public interface IVirtualDataSourceManager
|
||||
// {
|
||||
// bool IsMultiShardingConfiguration { get; }
|
||||
// ShardingConfigurationStrategyEnum ShardingConfigurationStrategy { get; }
|
||||
// IVirtualDataSource GetCurrentVirtualDataSource();
|
||||
// IVirtualDataSource GetVirtualDataSource(string configId);
|
||||
// List<IVirtualDataSource> GetAllVirtualDataSources();
|
||||
// bool ContansConfigId(string configId);
|
||||
//
|
||||
// /// <summary>
|
||||
// /// 创建分片配置scope
|
||||
// /// </summary>
|
||||
// /// <param name="configId"></param>
|
||||
// /// <returns></returns>
|
||||
// VirtualDataSourceScope CreateScope(string configId);
|
||||
// bool AddVirtualDataSource(IVirtualDataSourceConfigurationParams configurationParams);
|
||||
// void SetDefaultIfMultiConfiguration();
|
||||
//
|
||||
// }
|
||||
// }
|
|
@ -1,24 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ShardingCore.Core.VirtualDatabase.VirtualDataSources.Common
|
||||
{
|
||||
public enum ShardingConfigurationStrategyEnum
|
||||
{
|
||||
/// <summary>
|
||||
/// 返回空
|
||||
/// </summary>
|
||||
ReturnNull = 1,
|
||||
/// <summary>
|
||||
/// 抛出异常
|
||||
/// </summary>
|
||||
ThrowIfNull = 1 << 1,
|
||||
/// <summary>
|
||||
/// 返回优先级最高的
|
||||
/// </summary>
|
||||
ReturnHighPriority = 1 << 2
|
||||
}
|
||||
}
|
|
@ -9,8 +9,6 @@ using System.Collections.Concurrent;
|
|||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using System.Linq;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using ShardingCore.Core.ShardingConfigurations.Abstractions;
|
||||
|
||||
namespace ShardingCore.Core.VirtualDatabase.VirtualDataSources
|
||||
{
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
// using System;
|
||||
// using System.Collections.Generic;
|
||||
// using System.Linq;
|
||||
// using System.Text;
|
||||
// using System.Threading;
|
||||
// using System.Threading.Tasks;
|
||||
// using ShardingCore.Core.VirtualDatabase.VirtualDataSources.Abstractions;
|
||||
//
|
||||
// namespace ShardingCore.Core.VirtualDatabase.VirtualDataSources
|
||||
// {
|
||||
// public class VirtualDataSourceAccessor: IVirtualDataSourceAccessor
|
||||
// {
|
||||
// private static AsyncLocal<VirtualDataSourceContext> _shardingConfigurationContext = new AsyncLocal<VirtualDataSourceContext>();
|
||||
//
|
||||
// /// <summary>
|
||||
// /// sharding route context use in using code block
|
||||
// /// </summary>
|
||||
// public VirtualDataSourceContext DataSourceContext
|
||||
// {
|
||||
// get => _shardingConfigurationContext.Value;
|
||||
// set => _shardingConfigurationContext.Value = value;
|
||||
// }
|
||||
// }
|
||||
// }
|
|
@ -1,18 +0,0 @@
|
|||
// using System;
|
||||
// using System.Collections.Generic;
|
||||
// using System.Linq;
|
||||
// using System.Text;
|
||||
// using System.Threading.Tasks;
|
||||
//
|
||||
// namespace ShardingCore.Core.VirtualDatabase.VirtualDataSources
|
||||
// {
|
||||
// public class VirtualDataSourceContext
|
||||
// {
|
||||
// public string ConfigId { get; }
|
||||
//
|
||||
// public VirtualDataSourceContext(string configId)
|
||||
// {
|
||||
// ConfigId = configId;
|
||||
// }
|
||||
// }
|
||||
// }
|
|
@ -1,156 +0,0 @@
|
|||
// using System;
|
||||
// using System.Collections.Concurrent;
|
||||
// using System.Collections.Generic;
|
||||
// using System.Linq;
|
||||
// using System.Text;
|
||||
// using System.Threading.Tasks;
|
||||
// using Microsoft.EntityFrameworkCore;
|
||||
// using ShardingCore.Core.EntityMetadatas;
|
||||
// using ShardingCore.Core.ShardingConfigurations;
|
||||
// using ShardingCore.Core.ShardingConfigurations.Abstractions;
|
||||
// using ShardingCore.Core.VirtualDatabase.VirtualDataSources.Abstractions;
|
||||
// using ShardingCore.Core.VirtualDatabase.VirtualDataSources.Common;
|
||||
// using ShardingCore.Exceptions;
|
||||
// using ShardingCore.Extensions;
|
||||
// using ShardingCore.Sharding.Abstractions;
|
||||
// using ShardingCore.Sharding.ReadWriteConfigurations.Abstractions;
|
||||
//
|
||||
// namespace ShardingCore.Core.VirtualDatabase.VirtualDataSources
|
||||
// {
|
||||
// public class VirtualDataSourceManager : IVirtualDataSourceManager
|
||||
// {
|
||||
// private readonly IShardingConfigurationOptions _options;
|
||||
// private readonly IEntityMetadataManager _entityMetadataManager;
|
||||
// private readonly IVirtualDataSourceRouteManager _virtualDataSourceRouteManager;
|
||||
// private readonly IVirtualDataSourceAccessor _virtualDataSourceAccessor;
|
||||
// private readonly IReadWriteConnectorFactory _readWriteConnectorFactory;
|
||||
//
|
||||
// private readonly ConcurrentDictionary<string, IVirtualDataSource> _virtualDataSources = new();
|
||||
//
|
||||
// private string _defaultConfigId;
|
||||
// private IVirtualDataSource _defaultVirtualDataSource;
|
||||
// public VirtualDataSourceManager(IServiceProvider serviceProvider, IShardingConfigurationOptions options, IEntityMetadataManager entityMetadataManager, IVirtualDataSourceRouteManager virtualDataSourceRouteManager, IVirtualDataSourceAccessor virtualDataSourceAccessor,IReadWriteConnectorFactory readWriteConnectorFactory)
|
||||
// {
|
||||
//
|
||||
// _options = options;
|
||||
// _entityMetadataManager = entityMetadataManager;
|
||||
// _virtualDataSourceRouteManager = virtualDataSourceRouteManager;
|
||||
// var allShardingGlobalConfigOptions = options.GetAllShardingGlobalConfigOptions();
|
||||
// if (allShardingGlobalConfigOptions.IsEmpty())
|
||||
// throw new ArgumentException($"sharding virtual data source is empty");
|
||||
// _virtualDataSourceAccessor = virtualDataSourceAccessor;
|
||||
// _readWriteConnectorFactory = readWriteConnectorFactory;
|
||||
// if (options is ShardingMultiConfigurationOptions shardingMultiConfigurationOptions)
|
||||
// {
|
||||
// IsMultiShardingConfiguration = true;
|
||||
// ShardingConfigurationStrategy = shardingMultiConfigurationOptions.ShardingConfigurationStrategy;
|
||||
// }
|
||||
// else if (options is ShardingSingleConfigurationOptions shardingSingleConfigurationOptions)
|
||||
// {
|
||||
// IsMultiShardingConfiguration = false;
|
||||
// ShardingConfigurationStrategy = shardingSingleConfigurationOptions.ShardingConfigurationStrategy;
|
||||
// }
|
||||
// foreach (var shardingGlobalConfigOption in allShardingGlobalConfigOptions)
|
||||
// {
|
||||
// var simpleVirtualDataSourceConfigurationParams = new SimpleVirtualDataSourceConfigurationParams(serviceProvider, shardingGlobalConfigOption);
|
||||
// AddVirtualDataSource(simpleVirtualDataSourceConfigurationParams);
|
||||
// }
|
||||
// if (!IsMultiShardingConfiguration)
|
||||
// {
|
||||
// if (_defaultVirtualDataSource != null || _defaultConfigId != null)
|
||||
// throw new ShardingCoreInvalidOperationException("set sharding configuration error");
|
||||
// _defaultConfigId = _virtualDataSources.First().Key;
|
||||
// _defaultVirtualDataSource = _virtualDataSources.First().Value;
|
||||
// }
|
||||
// else if (ShardingConfigurationStrategy == ShardingConfigurationStrategyEnum.ReturnHighPriority)
|
||||
// {
|
||||
// var maxShardingConfiguration = _virtualDataSources.Values.OrderByDescending(o => o.Priority).FirstOrDefault();
|
||||
// _defaultVirtualDataSource = maxShardingConfiguration;
|
||||
// _defaultConfigId = maxShardingConfiguration.ConfigId;
|
||||
// }
|
||||
// }
|
||||
// public bool IsMultiShardingConfiguration { get; }
|
||||
// public ShardingConfigurationStrategyEnum ShardingConfigurationStrategy { get; }
|
||||
// public IVirtualDataSource GetCurrentVirtualDataSource()
|
||||
// {
|
||||
// if (!IsMultiShardingConfiguration)
|
||||
// return _defaultVirtualDataSource;
|
||||
// var configId = _virtualDataSourceAccessor.DataSourceContext?.ConfigId;
|
||||
// if (!string.IsNullOrWhiteSpace(configId))
|
||||
// {
|
||||
// var hasValue = _virtualDataSources.TryGetValue(configId, out var virtualDataSource);
|
||||
// if (hasValue)
|
||||
// {
|
||||
// return virtualDataSource;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// switch (ShardingConfigurationStrategy)
|
||||
// {
|
||||
// case ShardingConfigurationStrategyEnum.ReturnNull: return null;
|
||||
// case ShardingConfigurationStrategyEnum.ReturnHighPriority: return _defaultVirtualDataSource;
|
||||
// case ShardingConfigurationStrategyEnum.ThrowIfNull: throw new ShardingCoreNotFoundException($"no configuration,config id:[{configId}]");
|
||||
// default:
|
||||
// throw new ShardingCoreException(
|
||||
// $"unknown {nameof(ShardingConfigurationStrategyEnum)}:[{ShardingConfigurationStrategy}]");
|
||||
// }
|
||||
// }
|
||||
// public IVirtualDataSource GetVirtualDataSource(string configId)
|
||||
// {
|
||||
// var hasValue = _virtualDataSources.TryGetValue(configId, out var virtualDataSource);
|
||||
// if (hasValue)
|
||||
// {
|
||||
// return virtualDataSource;
|
||||
// }
|
||||
// switch (ShardingConfigurationStrategy)
|
||||
// {
|
||||
// case ShardingConfigurationStrategyEnum.ReturnNull: return null;
|
||||
// case ShardingConfigurationStrategyEnum.ReturnHighPriority: return _defaultVirtualDataSource;
|
||||
// case ShardingConfigurationStrategyEnum.ThrowIfNull: throw new ShardingCoreNotFoundException($"no configuration,config id:[{configId}]");
|
||||
// default:
|
||||
// throw new ShardingCoreException(
|
||||
// $"unknown {nameof(ShardingConfigurationStrategyEnum)}:[{ShardingConfigurationStrategy}]");
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public bool ContansConfigId(string configId)
|
||||
// {
|
||||
// return _virtualDataSources.ContainsKey(configId);
|
||||
// }
|
||||
//
|
||||
// public bool AddVirtualDataSource(IVirtualDataSourceConfigurationParams configurationParams)
|
||||
// {
|
||||
// if (!IsMultiShardingConfiguration&&_virtualDataSources.IsNotEmpty())
|
||||
// throw new NotSupportedException("not support multi sharding configuration");
|
||||
// var dataSource = new VirtualDataSource(_entityMetadataManager, _virtualDataSourceRouteManager, configurationParams,_readWriteConnectorFactory);
|
||||
// dataSource.CheckVirtualDataSource();
|
||||
// return _virtualDataSources.TryAdd(dataSource.ConfigId, dataSource);
|
||||
// }
|
||||
//
|
||||
// public void SetDefaultIfMultiConfiguration()
|
||||
// {
|
||||
// if (IsMultiShardingConfiguration && ShardingConfigurationStrategy == ShardingConfigurationStrategyEnum.ReturnHighPriority)
|
||||
// {
|
||||
// var maxShardingConfiguration = _virtualDataSources.Values.OrderByDescending(o => o.Priority).FirstOrDefault();
|
||||
// if (maxShardingConfiguration.ConfigId != _defaultConfigId)
|
||||
// {
|
||||
// _defaultConfigId = maxShardingConfiguration.ConfigId;
|
||||
// _defaultVirtualDataSource = maxShardingConfiguration;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// public List<IVirtualDataSource> GetAllVirtualDataSources()
|
||||
// {
|
||||
// if (!IsMultiShardingConfiguration)
|
||||
// return new List<IVirtualDataSource>(1) { _defaultVirtualDataSource };
|
||||
// return _virtualDataSources.Values.ToList();
|
||||
// }
|
||||
//
|
||||
// public VirtualDataSourceScope CreateScope(string configId)
|
||||
// {
|
||||
// var virtualDataSourceScope = new VirtualDataSourceScope(_virtualDataSourceAccessor);
|
||||
// _virtualDataSourceAccessor.DataSourceContext = new VirtualDataSourceContext(configId);
|
||||
// return virtualDataSourceScope;
|
||||
// }
|
||||
// }
|
||||
// }
|
|
@ -1,34 +0,0 @@
|
|||
// using System;
|
||||
// using System.Collections.Generic;
|
||||
// using System.Linq;
|
||||
// using System.Text;
|
||||
// using System.Threading.Tasks;
|
||||
// using ShardingCore.Core.VirtualDatabase.VirtualDataSources.Abstractions;
|
||||
//
|
||||
// namespace ShardingCore.Core.VirtualDatabase.VirtualDataSources
|
||||
// {
|
||||
// public class VirtualDataSourceScope:IDisposable
|
||||
// {
|
||||
// /// <summary>
|
||||
// /// 分片配置访问器
|
||||
// /// </summary>
|
||||
// public IVirtualDataSourceAccessor VirtualDataSourceAccessor { get; }
|
||||
//
|
||||
// /// <summary>
|
||||
// /// 构造函数
|
||||
// /// </summary>
|
||||
// /// <param name="virtualDataSourceAccessor"></param>
|
||||
// public VirtualDataSourceScope(IVirtualDataSourceAccessor virtualDataSourceAccessor)
|
||||
// {
|
||||
// VirtualDataSourceAccessor = virtualDataSourceAccessor;
|
||||
// }
|
||||
//
|
||||
// /// <summary>
|
||||
// /// 回收
|
||||
// /// </summary>
|
||||
// public void Dispose()
|
||||
// {
|
||||
// VirtualDataSourceAccessor.DataSourceContext = null;
|
||||
// }
|
||||
// }
|
||||
// }
|
|
@ -1,132 +0,0 @@
|
|||
// using ShardingCore.Core.PhysicTables;
|
||||
// using ShardingCore.Core.VirtualRoutes.TableRoutes;
|
||||
// using ShardingCore.Exceptions;
|
||||
// using ShardingCore.Extensions;
|
||||
// using ShardingCore.Sharding.PaginationConfigurations;
|
||||
// using ShardingCore.Utils;
|
||||
// using System;
|
||||
// using System.Collections.Concurrent;
|
||||
// using System.Collections.Generic;
|
||||
// using System.Linq;
|
||||
// using System.Linq.Expressions;
|
||||
// using ShardingCore.Core.EntityMetadatas;
|
||||
// using ShardingCore.Core.ShardingEnumerableQueries;
|
||||
// using ShardingCore.Core.VirtualDatabase;
|
||||
// using ShardingCore.Core.VirtualDatabase.VirtualDataSources;
|
||||
// using ShardingCore.Core.VirtualRoutes.DataSourceRoutes.RouteRuleEngine;
|
||||
// using ShardingCore.Sharding.EntityQueryConfigurations;
|
||||
// using ShardingCore.Sharding.MergeEngines.Common.Abstractions;
|
||||
//
|
||||
// namespace ShardingCore.Core.VirtualTables
|
||||
// {
|
||||
// /*
|
||||
// * @Author: xjm
|
||||
// * @Description:
|
||||
// * @Date: Friday, 18 December 2020 14:20:12
|
||||
// * @Email: 326308290@qq.com
|
||||
// */
|
||||
// /// <summary>
|
||||
// /// 同数据库虚拟表
|
||||
// /// </summary>
|
||||
// /// <typeparam name="T"></typeparam>
|
||||
// public class DefaultVirtualTable<T> : IVirtualTable<T> where T : class
|
||||
// {
|
||||
// public EntityMetadata EntityMetadata { get; }
|
||||
// private readonly IVirtualTableRoute<T> _virtualTableRoute;
|
||||
//
|
||||
// /// <summary>
|
||||
// /// 分页配置
|
||||
// /// </summary>
|
||||
// public PaginationMetadata PaginationMetadata { get; }
|
||||
//
|
||||
// /// <summary>
|
||||
// /// 是否启用智能分页
|
||||
// /// </summary>
|
||||
// public bool EnablePagination => PaginationMetadata != null;
|
||||
// /// <summary>
|
||||
// /// 查询配置
|
||||
// /// </summary>
|
||||
// public EntityQueryMetadata EntityQueryMetadata { get; }
|
||||
// /// <summary>
|
||||
// /// 是否启用表达式分片配置
|
||||
// /// </summary>
|
||||
// public bool EnableEntityQuery => EntityQueryMetadata != null;
|
||||
//
|
||||
//
|
||||
// private readonly ConcurrentDictionary<IPhysicTable, object> _physicTables = new ConcurrentDictionary<IPhysicTable, object>();
|
||||
//
|
||||
// public DefaultVirtualTable(IVirtualTableRoute<T> virtualTableRoute,EntityMetadata entityMetadata)
|
||||
// {
|
||||
// EntityMetadata = entityMetadata;
|
||||
// _virtualTableRoute = virtualTableRoute;
|
||||
// var paginationConfiguration = virtualTableRoute.CreatePaginationConfiguration();
|
||||
// if (paginationConfiguration!=null)
|
||||
// {
|
||||
// PaginationMetadata = new PaginationMetadata();
|
||||
// var paginationBuilder = new PaginationBuilder<T>(PaginationMetadata);
|
||||
// paginationConfiguration.Configure(paginationBuilder);
|
||||
// }
|
||||
//
|
||||
// var entityQueryConfiguration = virtualTableRoute.CreateEntityQueryConfiguration();
|
||||
// if (entityQueryConfiguration != null)
|
||||
// {
|
||||
// EntityQueryMetadata = new EntityQueryMetadata();
|
||||
// var entityQueryBuilder = new EntityQueryBuilder<T>(EntityQueryMetadata);
|
||||
// entityQueryConfiguration.Configure(entityQueryBuilder);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public List<IPhysicTable> GetAllPhysicTables()
|
||||
// {
|
||||
// return _physicTables.Keys.ToList();
|
||||
// }
|
||||
//
|
||||
// public List<ISqlRouteUnit> RouteTo(DataSourceRouteResult dataSourceRouteResult,ShardingTableRouteConfig tableRouteConfig)
|
||||
// {
|
||||
// var route = _virtualTableRoute;
|
||||
// if (tableRouteConfig.UseQueryable())
|
||||
// return route.RouteWithPredicate(GetAllPhysicTables(), tableRouteConfig.GetQueryable(), true);
|
||||
// if (tableRouteConfig.UsePredicate())
|
||||
// return route.RouteWithPredicate(GetAllPhysicTables(), new ShardingEmptyEnumerableQuery<T>((Expression<Func<T, bool>>)tableRouteConfig.GetPredicate()).EmptyQueryable(), false);
|
||||
// object shardingKeyValue = null;
|
||||
// if (tableRouteConfig.UseValue())
|
||||
// shardingKeyValue = tableRouteConfig.GetShardingKeyValue();
|
||||
//
|
||||
// if (tableRouteConfig.UseEntity())
|
||||
// shardingKeyValue = tableRouteConfig.GetShardingEntity().GetPropertyValue(EntityMetadata.ShardingTableProperty.Name);
|
||||
//
|
||||
// if (shardingKeyValue == null)
|
||||
// throw new ShardingCoreException(" route entity queryable or sharding key value is null ");
|
||||
// var routeWithValue = route.RouteWithValue(GetAllPhysicTables(), shardingKeyValue);
|
||||
// return new List<IPhysicTable>(1) { routeWithValue };
|
||||
// }
|
||||
//
|
||||
//
|
||||
// public bool AddPhysicTable(IPhysicTable physicTable)
|
||||
// {
|
||||
// if (physicTable.EntityType != EntityMetadata.EntityType)
|
||||
// throw new ShardingCoreInvalidOperationException($"virtual table entity type :[{EntityMetadata.EntityType.FullName}] physic table entity type:[{physicTable.EntityType.FullName}]");
|
||||
// return _physicTables.TryAdd(physicTable, null);
|
||||
// }
|
||||
//
|
||||
// // public string GetVirtualTableName()
|
||||
// // {
|
||||
// // return EntityMetadata.VirtualTableName;
|
||||
// // }
|
||||
//
|
||||
// IVirtualTableRoute IVirtualTable.GetVirtualRoute()
|
||||
// {
|
||||
// return GetVirtualRoute();
|
||||
// }
|
||||
//
|
||||
// public List<string> GetTableAllTails()
|
||||
// {
|
||||
// return _physicTables.Keys.Select(o => o.Tail).ToList();
|
||||
// }
|
||||
//
|
||||
// public IVirtualTableRoute<T> GetVirtualRoute()
|
||||
// {
|
||||
// return _virtualTableRoute;
|
||||
// }
|
||||
// }
|
||||
// }
|
|
@ -1,87 +0,0 @@
|
|||
// using System;
|
||||
// using System.Collections.Generic;
|
||||
// using ShardingCore.Bootstrappers;
|
||||
// using ShardingCore.Core.EntityMetadatas;
|
||||
// using ShardingCore.Core.PhysicTables;
|
||||
// using ShardingCore.Core.VirtualDatabase;
|
||||
// using ShardingCore.Core.VirtualDatabase.VirtualDataSources;
|
||||
// using ShardingCore.Core.VirtualRoutes.DataSourceRoutes.RouteRuleEngine;
|
||||
// using ShardingCore.Core.VirtualRoutes.TableRoutes;
|
||||
// using ShardingCore.Sharding.EntityQueryConfigurations;
|
||||
// using ShardingCore.Sharding.MergeEngines.Common.Abstractions;
|
||||
// using ShardingCore.Sharding.PaginationConfigurations;
|
||||
//
|
||||
// namespace ShardingCore.Core.VirtualTables
|
||||
// {
|
||||
// /*
|
||||
// * @Author: xjm
|
||||
// * @Description:虚拟表在系统里面被映射为ef-core的表
|
||||
// * @Date: Friday, 18 December 2020 14:06:31
|
||||
// * @Email: 326308290@qq.com
|
||||
// */
|
||||
// /// <summary>
|
||||
// /// 虚拟表
|
||||
// /// </summary>
|
||||
// public interface IVirtualTable
|
||||
// {
|
||||
// EntityMetadata EntityMetadata { get; }
|
||||
// /// <summary>
|
||||
// /// 分页配置
|
||||
// /// </summary>
|
||||
// PaginationMetadata PaginationMetadata { get; }
|
||||
// /// <summary>
|
||||
// /// 是否启用分页配置
|
||||
// /// </summary>
|
||||
// bool EnablePagination { get; }
|
||||
// /// <summary>
|
||||
// /// 查询配置
|
||||
// /// </summary>
|
||||
// EntityQueryMetadata EntityQueryMetadata { get; }
|
||||
// /// <summary>
|
||||
// /// 是否启用表达式分片配置
|
||||
// /// </summary>
|
||||
// bool EnableEntityQuery { get; }
|
||||
//
|
||||
// /// <summary>
|
||||
// /// 获取所有的物理表
|
||||
// /// </summary>
|
||||
// /// <returns></returns>
|
||||
// List<IPhysicTable> GetAllPhysicTables();
|
||||
//
|
||||
// /// <summary>
|
||||
// /// 路由到具体的物理表 which physic table route
|
||||
// /// </summary>
|
||||
// /// <param name="dataSourceRouteResult"></param>
|
||||
// /// <param name="tableRouteConfig"></param>
|
||||
// /// <returns></returns>
|
||||
// List<ISqlRouteUnit> RouteTo(DataSourceRouteResult dataSourceRouteResult,ShardingTableRouteConfig tableRouteConfig);
|
||||
//
|
||||
// /// <summary>
|
||||
// /// 添加物理表 add physic table
|
||||
// /// </summary>
|
||||
// /// <param name="physicTable"></param>
|
||||
// /// <returns>添加成功</returns>
|
||||
// bool AddPhysicTable(IPhysicTable physicTable);
|
||||
// // /// <summary>
|
||||
// // /// 获取原始表名 get original table name
|
||||
// // /// </summary>
|
||||
// // /// <returns></returns>
|
||||
// // string GetVirtualTableName();
|
||||
// /// <summary>
|
||||
// /// 获取当前虚拟表的路由 get this virtual table route
|
||||
// /// </summary>
|
||||
// /// <returns></returns>
|
||||
// IVirtualTableRoute GetVirtualRoute();
|
||||
// /// <summary>
|
||||
// /// 获取启动时已经存在的表后缀 get this virtual table exists tails when app start
|
||||
// /// <see cref="ShardingBootstrapper"/> CreateDateTables
|
||||
// /// </summary>
|
||||
// /// <returns></returns>
|
||||
// List<string> GetTableAllTails();
|
||||
// }
|
||||
//
|
||||
// public interface IVirtualTable<T> : IVirtualTable where T : class
|
||||
// {
|
||||
// new IVirtualTableRoute<T> GetVirtualRoute();
|
||||
// }
|
||||
// }
|
|
@ -1,61 +0,0 @@
|
|||
// using System;
|
||||
// using System.Collections.Generic;
|
||||
// using Microsoft.EntityFrameworkCore;
|
||||
// using ShardingCore.Core.PhysicTables;
|
||||
// using ShardingCore.Core.VirtualTables;
|
||||
// using ShardingCore.Sharding.Abstractions;
|
||||
//
|
||||
// namespace ShardingCore.Core.VirtualDatabase.VirtualTables
|
||||
// {
|
||||
// /*
|
||||
// * @Author: xjm
|
||||
// * @Description: 用于管理虚拟表并且提供简单的操作方法api
|
||||
// * @Date: Friday, 18 December 2020 14:10:03
|
||||
// * @Email: 326308290@qq.com
|
||||
// */
|
||||
// [Obsolete]
|
||||
// public interface IVirtualTableManager
|
||||
// {
|
||||
//
|
||||
// /// <summary>
|
||||
// /// 添加虚拟表应用启动时 add virtual table when app start
|
||||
// /// </summary>
|
||||
// /// <param name="virtualTable">虚拟表</param>
|
||||
// bool AddVirtualTable(IVirtualTable virtualTable);
|
||||
//
|
||||
// /// <summary>
|
||||
// /// 获取虚拟表 get virtual table by sharding entity type
|
||||
// /// </summary>
|
||||
// /// <param name="shardingEntityType"></param>
|
||||
// /// <returns></returns>
|
||||
// IVirtualTable GetVirtualTable(Type shardingEntityType);
|
||||
// /// <summary>
|
||||
// /// 尝试获取虚拟表
|
||||
// /// </summary>
|
||||
// /// <param name="shardingEntityType"></param>
|
||||
// /// <returns></returns>
|
||||
// IVirtualTable TryGetVirtualTable(Type shardingEntityType);
|
||||
//
|
||||
// /// <summary>
|
||||
// /// 获取所有的虚拟表 get all virtual table
|
||||
// /// </summary>
|
||||
// /// <returns></returns>
|
||||
// ISet<IVirtualTable> GetAllVirtualTables();
|
||||
//
|
||||
//
|
||||
// /// <summary>
|
||||
// /// 添加物理表 add physic table
|
||||
// /// </summary>
|
||||
// /// <param name="virtualTable"></param>
|
||||
// /// <param name="physicTable"></param>
|
||||
// bool AddPhysicTable(IVirtualTable virtualTable, IPhysicTable physicTable);
|
||||
//
|
||||
//
|
||||
// /// <summary>
|
||||
// /// 添加物理表 add physic table
|
||||
// /// </summary>
|
||||
// /// <param name="shardingEntityType"></param>
|
||||
// /// <param name="physicTable"></param>
|
||||
// bool AddPhysicTable(Type shardingEntityType, IPhysicTable physicTable);
|
||||
// }
|
||||
// }
|
|
@ -1,226 +0,0 @@
|
|||
// using System;
|
||||
// using System.Collections.Concurrent;
|
||||
// using System.Collections.Generic;
|
||||
// using System.Linq;
|
||||
// using Microsoft.EntityFrameworkCore;
|
||||
// using ShardingCore.Core.EntityMetadatas;
|
||||
// using ShardingCore.Core.PhysicTables;
|
||||
// using ShardingCore.Core.VirtualTables;
|
||||
// using ShardingCore.Exceptions;
|
||||
// using ShardingCore.Extensions;
|
||||
// using ShardingCore.Sharding.Abstractions;
|
||||
//
|
||||
// namespace ShardingCore.Core.VirtualDatabase.VirtualTables
|
||||
// {
|
||||
// /*
|
||||
// * @Author: xjm
|
||||
// * @Description:
|
||||
// * @Date: Friday, 18 December 2020 14:52:42
|
||||
// * @Email: 326308290@qq.com
|
||||
// */
|
||||
// /// <summary>
|
||||
// /// 同一个数据库下的虚拟表管理者
|
||||
// /// </summary>
|
||||
// public class VirtualTableManager : IVirtualTableManager
|
||||
// {
|
||||
// private readonly IEntityMetadataManager _entityMetadataManager;
|
||||
//
|
||||
// /// <summary>
|
||||
// /// {entityType,virtualTableType}
|
||||
// /// </summary>
|
||||
// private readonly ConcurrentDictionary<Type, IVirtualTable> _shardingVirtualTables = new ConcurrentDictionary<Type, IVirtualTable>();
|
||||
// public VirtualTableManager(IEntityMetadataManager entityMetadataManager)
|
||||
// {
|
||||
// _entityMetadataManager = entityMetadataManager;
|
||||
// }
|
||||
//
|
||||
// public bool AddVirtualTable(IVirtualTable virtualTable)
|
||||
// {
|
||||
// var result = _shardingVirtualTables.TryAdd(virtualTable.EntityMetadata.EntityType, virtualTable);
|
||||
// return result;
|
||||
// }
|
||||
// /// <summary>
|
||||
// /// 获取对应的虚拟表
|
||||
// /// </summary>
|
||||
// /// <param name="shardingEntityType"></param>
|
||||
// /// <returns></returns>
|
||||
// public IVirtualTable GetVirtualTable(Type shardingEntityType)
|
||||
// {
|
||||
// if (!_entityMetadataManager.IsShardingTable(shardingEntityType))
|
||||
// throw new ShardingCoreInvalidOperationException(shardingEntityType.FullName);
|
||||
// if (!_shardingVirtualTables.TryGetValue(shardingEntityType, out var virtualTable))
|
||||
// throw new ShardingCoreException($"virtual table not found entity: {shardingEntityType.FullName}");
|
||||
// return virtualTable;
|
||||
// }
|
||||
//
|
||||
// public IVirtualTable TryGetVirtualTable(Type shardingEntityType)
|
||||
// {
|
||||
// if (!_entityMetadataManager.IsShardingTable(shardingEntityType))
|
||||
// throw new ShardingCoreInvalidOperationException(shardingEntityType.FullName);
|
||||
// if (!_shardingVirtualTables.TryGetValue(shardingEntityType, out var virtualTable))
|
||||
// return null;
|
||||
// return virtualTable;
|
||||
// }
|
||||
// public ISet<IVirtualTable> GetAllVirtualTables()
|
||||
// {
|
||||
// return _shardingVirtualTables.Select(o => o.Value).ToHashSet();
|
||||
// }
|
||||
//
|
||||
// public bool AddPhysicTable(IVirtualTable virtualTable, IPhysicTable physicTable)
|
||||
// {
|
||||
// return AddPhysicTable(virtualTable.EntityMetadata.EntityType, physicTable);
|
||||
// }
|
||||
//
|
||||
// public bool AddPhysicTable(Type shardingEntityType, IPhysicTable physicTable)
|
||||
// {
|
||||
// if (!_shardingVirtualTables.TryGetValue(shardingEntityType, out var virtualTable))
|
||||
// throw new ShardingCoreException($"virtual table not found entity: {shardingEntityType.FullName}");
|
||||
// return virtualTable.AddPhysicTable(physicTable);
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// ///// <summary>
|
||||
// ///// {sharidngDbContextType:{entityType,virtualTableType}}
|
||||
// ///// </summary>
|
||||
// //private readonly ConcurrentDictionary<Type, ConcurrentDictionary<Type, IVirtualTable>> _shardingVirtualTables = new ConcurrentDictionary<Type, ConcurrentDictionary<Type, IVirtualTable>>();
|
||||
// //private readonly ConcurrentDictionary<Type, ConcurrentDictionary<string, IVirtualTable>> _shardingVirtualTaleVirtualTables = new ConcurrentDictionary<Type, ConcurrentDictionary<string, IVirtualTable>>();
|
||||
// //public VirtualTableManager()
|
||||
// //{
|
||||
//
|
||||
// //}
|
||||
//
|
||||
// //private void CheckShardingDbContextType(Type shardingDbContextType)
|
||||
// //{
|
||||
// // if (!shardingDbContextType.IsShardingDbContext())
|
||||
// // throw new ShardingCoreException(
|
||||
// // $"{shardingDbContextType.FullName} must impl {nameof(IShardingDbContext)}");
|
||||
// //}
|
||||
//
|
||||
// //private void CheckShardingTableEntityType(Type shardingEntityType)
|
||||
// //{
|
||||
// // if (!shardingEntityType.IsShardingTable())
|
||||
// // throw new ShardingCoreException(
|
||||
// // $"{shardingEntityType.FullName} must impl {nameof(IShardingTable)}");
|
||||
// //}
|
||||
// //private string CreateShardingEntityTypeKey(Type shardingDbContextType,Type entityType)
|
||||
// //{
|
||||
// // return $"{shardingDbContextType.FullName}{entityType.FullName}";
|
||||
// //}
|
||||
// //private string CreateShardingTableNameKey(Type shardingDbContextType,string originalTableName)
|
||||
// //{
|
||||
// // return $"{shardingDbContextType.FullName}{originalTableName}";
|
||||
// //}
|
||||
//
|
||||
// //public void AddVirtualTable(Type shardingDbContextType,IVirtualTable virtualTable)
|
||||
// //{
|
||||
// // CheckShardingDbContextType(shardingDbContextType);
|
||||
//
|
||||
// // var innerShardingVirtualTables = _shardingVirtualTables.GetOrAdd(shardingDbContextType,
|
||||
// // key => new ConcurrentDictionary<Type, IVirtualTable>());
|
||||
//
|
||||
// // if (!innerShardingVirtualTables.ContainsKey(virtualTable.EntityType))
|
||||
// // {
|
||||
// // innerShardingVirtualTables.TryAdd(virtualTable.EntityType, virtualTable);
|
||||
// // }
|
||||
//
|
||||
// // var innerShardingOriginalTableVirtualTables = _shardingVirtualTaleVirtualTables.GetOrAdd(shardingDbContextType,type=>new ConcurrentDictionary<string, IVirtualTable>());
|
||||
//
|
||||
// // if (!innerShardingOriginalTableVirtualTables.ContainsKey(virtualTable.GetVirtualTableName()))
|
||||
// // {
|
||||
// // innerShardingOriginalTableVirtualTables.TryAdd(virtualTable.GetVirtualTableName(), virtualTable);
|
||||
// // }
|
||||
// //}
|
||||
//
|
||||
// //public IVirtualTable GetVirtualTable(Type shardingDbContextType,Type shardingEntityType)
|
||||
// //{
|
||||
// // CheckShardingDbContextType(shardingDbContextType);
|
||||
// // CheckShardingTableEntityType(shardingEntityType);
|
||||
//
|
||||
// // var shardingKey = CreateShardingEntityTypeKey(shardingDbContextType, shardingEntityType);
|
||||
// // if(!_shardingVirtualTables.TryGetValue(shardingDbContextType,out var innerShardingVirtualTables) || innerShardingVirtualTables.IsEmpty())
|
||||
// // throw new ShardingVirtualTableNotFoundException(shardingDbContextType.FullName);
|
||||
//
|
||||
// // if (!innerShardingVirtualTables.TryGetValue(shardingEntityType, out var virtualTable)||virtualTable==null)
|
||||
// // throw new ShardingVirtualTableNotFoundException(shardingEntityType.FullName);
|
||||
// // return virtualTable;
|
||||
// //}
|
||||
//
|
||||
//
|
||||
// //public IVirtualTable<T> GetVirtualTable<TDbContext, T>() where T : class, IShardingTable where TDbContext : DbContext, IShardingDbContext
|
||||
// //{
|
||||
// // return (IVirtualTable<T>)GetVirtualTable(typeof(TDbContext), typeof(T));
|
||||
// //}
|
||||
//
|
||||
// //public IVirtualTable GetVirtualTable(Type shardingDbContextType, string originalTableName)
|
||||
// //{
|
||||
// // CheckShardingDbContextType(shardingDbContextType);
|
||||
// // if (!_shardingVirtualTaleVirtualTables.TryGetValue(shardingDbContextType, out var innerShardingOriginalTableVirtualTables) || innerShardingOriginalTableVirtualTables.IsEmpty())
|
||||
// // throw new ShardingVirtualTableNotFoundException(shardingDbContextType.FullName);
|
||||
// // if(!innerShardingOriginalTableVirtualTables.TryGetValue(originalTableName,out var virtualTable)|| virtualTable==null)
|
||||
// // throw new ShardingVirtualTableNotFoundException(originalTableName);
|
||||
// // return virtualTable;
|
||||
// //}
|
||||
//
|
||||
// //public IVirtualTable GetVirtualTable<TDbContext>(string originalTableName) where TDbContext : DbContext, IShardingDbContext
|
||||
// //{
|
||||
// // return GetVirtualTable(typeof(TDbContext),originalTableName);
|
||||
// //}
|
||||
//
|
||||
// //public IVirtualTable TryGetVirtualTable(Type shardingDbContextType,string originalTableName)
|
||||
// //{
|
||||
// // CheckShardingDbContextType(shardingDbContextType);
|
||||
// // if (!_shardingVirtualTaleVirtualTables.TryGetValue(shardingDbContextType,
|
||||
// // out var innerShardingOriginalTableVirtualTables) || innerShardingOriginalTableVirtualTables.IsEmpty())
|
||||
// // return null;
|
||||
// // if (!innerShardingOriginalTableVirtualTables.TryGetValue(originalTableName, out var virtualTable) || virtualTable == null)
|
||||
// // return null;
|
||||
// // return virtualTable;
|
||||
// //}
|
||||
//
|
||||
// //public IVirtualTable TryGetVirtualTablee<TDbContext>(string originalTableName) where TDbContext : DbContext, IShardingDbContext
|
||||
// //{
|
||||
// // return TryGetVirtualTable(typeof(TDbContext), originalTableName);
|
||||
// //}
|
||||
//
|
||||
//
|
||||
// //public List<IVirtualTable> GetAllVirtualTables(Type shardingDbContextType)
|
||||
// //{
|
||||
// // if (!_shardingVirtualTaleVirtualTables.TryGetValue(shardingDbContextType,
|
||||
// // out var innerShardingOriginalTableVirtualTables) || innerShardingOriginalTableVirtualTables.IsEmpty())
|
||||
// // return new List<IVirtualTable>();
|
||||
// // var keyPrefix = shardingDbContextType.FullName;
|
||||
// // return innerShardingOriginalTableVirtualTables.Values.ToList();
|
||||
// //}
|
||||
//
|
||||
// //public List<IVirtualTable> GetAllVirtualTables<TDbContext>() where TDbContext : DbContext, IShardingDbContext
|
||||
// //{
|
||||
// // return GetAllVirtualTables(typeof(TDbContext));
|
||||
// //}
|
||||
//
|
||||
// //public void AddPhysicTable(Type shardingDbContextType,IVirtualTable virtualTable, IPhysicTable physicTable)
|
||||
// //{
|
||||
// // AddPhysicTable(shardingDbContextType, virtualTable.EntityType, physicTable);
|
||||
// //}
|
||||
//
|
||||
// //public void AddPhysicTable<TDbContext>(IVirtualTable virtualTable, IPhysicTable physicTable) where TDbContext : DbContext, IShardingDbContext
|
||||
// //{
|
||||
// // AddPhysicTable(typeof(TDbContext),virtualTable.EntityType, physicTable);
|
||||
// //}
|
||||
//
|
||||
//
|
||||
// //public void AddPhysicTable(Type shardingDbContextType,Type shardingEntityType, IPhysicTable physicTable)
|
||||
// //{
|
||||
// // var virtualTable = GetVirtualTable(shardingDbContextType,shardingEntityType);
|
||||
// // virtualTable.AddPhysicTable(physicTable);
|
||||
// //}
|
||||
//
|
||||
//
|
||||
// //public void AddPhysicTable<TDbContext>(Type shardingEntityType, IPhysicTable physicTable) where TDbContext : DbContext, IShardingDbContext
|
||||
// //{
|
||||
// // var virtualTable = GetVirtualTable(typeof(TDbContext),shardingEntityType);
|
||||
// // virtualTable.AddPhysicTable(physicTable);
|
||||
// //}
|
||||
// }
|
||||
// }
|
|
@ -9,14 +9,48 @@ namespace ShardingCore.Core.VirtualRoutes.Abstractions
|
|||
|
||||
public interface ITableRouteManager
|
||||
{
|
||||
/// <summary>
|
||||
/// 实体对象是否存在分表路由
|
||||
/// </summary>
|
||||
/// <param name="entityType"></param>
|
||||
/// <returns></returns>
|
||||
bool HasRoute(Type entityType);
|
||||
/// <summary>
|
||||
/// 获取实体对象的分表路由,如果没有将抛出异常
|
||||
/// </summary>
|
||||
/// <param name="entityType"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="ShardingCoreInvalidOperationException">如果没有找到对应的路由</exception>
|
||||
IVirtualTableRoute GetRoute(Type entityType);
|
||||
/// <summary>
|
||||
/// 获取所有的分表路由
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
List<IVirtualTableRoute> GetRoutes();
|
||||
/// <summary>
|
||||
/// 添加分表路由
|
||||
/// </summary>
|
||||
/// <param name="route"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="ShardingCoreInvalidOperationException">如果当前路由的对象不是分表对象将抛出异常</exception>
|
||||
bool AddRoute(IVirtualTableRoute route);
|
||||
|
||||
List<ShardingRouteUnit> RouteTo(Type entityType,
|
||||
/// <summary>
|
||||
/// 直接路由采用默认数据源
|
||||
/// </summary>
|
||||
/// <param name="entityType"></param>
|
||||
/// <param name="shardingTableRouteConfig"></param>
|
||||
/// <returns></returns>
|
||||
List<TableRouteUnit> RouteTo(Type entityType,
|
||||
ShardingTableRouteConfig shardingTableRouteConfig);
|
||||
List<ShardingRouteUnit> RouteTo(Type entityType,DataSourceRouteResult dataSourceRouteResult,
|
||||
/// <summary>
|
||||
/// 根据数据源路由进行分片路由
|
||||
/// </summary>
|
||||
/// <param name="entityType"></param>
|
||||
/// <param name="dataSourceRouteResult"></param>
|
||||
/// <param name="shardingTableRouteConfig"></param>
|
||||
/// <returns></returns>
|
||||
List<TableRouteUnit> RouteTo(Type entityType,DataSourceRouteResult dataSourceRouteResult,
|
||||
ShardingTableRouteConfig shardingTableRouteConfig);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,9 +2,9 @@ using System;
|
|||
|
||||
namespace ShardingCore.Core.VirtualRoutes
|
||||
{
|
||||
public sealed class ShardingRouteUnit
|
||||
public sealed class TableRouteUnit
|
||||
{
|
||||
public ShardingRouteUnit(string dataSourceName, string tail,Type entityType)
|
||||
public TableRouteUnit(string dataSourceName, string tail,Type entityType)
|
||||
{
|
||||
DataSourceName = dataSourceName;
|
||||
Tail = tail;
|
||||
|
@ -15,14 +15,14 @@ namespace ShardingCore.Core.VirtualRoutes
|
|||
public string Tail { get;}
|
||||
public Type EntityType { get; }
|
||||
|
||||
private bool Equals(ShardingRouteUnit other)
|
||||
private bool Equals(TableRouteUnit other)
|
||||
{
|
||||
return DataSourceName == other.DataSourceName && Tail == other.Tail && EntityType == other.EntityType;
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
return ReferenceEquals(this, obj) || obj is ShardingRouteUnit other && Equals(other);
|
||||
return ReferenceEquals(this, obj) || obj is TableRouteUnit other && Equals(other);
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
|
@ -41,7 +41,7 @@ namespace ShardingCore.Core.VirtualRoutes.TableRoutes.Abstractions
|
|||
/// 路由数据源和表后缀连接符
|
||||
/// </summary>
|
||||
protected virtual string RouteSeparator => ".";
|
||||
public override List<ShardingRouteUnit> RouteWithPredicate(DataSourceRouteResult dataSourceRouteResult, IQueryable queryable,bool isQuery)
|
||||
public override List<TableRouteUnit> RouteWithPredicate(DataSourceRouteResult dataSourceRouteResult, IQueryable queryable,bool isQuery)
|
||||
{
|
||||
if (!isQuery)
|
||||
{
|
||||
|
@ -59,7 +59,7 @@ namespace ShardingCore.Core.VirtualRoutes.TableRoutes.Abstractions
|
|||
if (filterTails.IsEmpty()||filterTails.Count!=mustTails.Count)
|
||||
throw new ShardingCoreException(
|
||||
$" sharding route must error:[{EntityMetadata.EntityType.FullName}]-->[{string.Join(",",mustTails)}]");
|
||||
var shardingRouteUnits = dataSourceRouteResult.IntersectDataSources.SelectMany(dataSourceName=>filterTails.Select(tail=> new ShardingRouteUnit(dataSourceName,tail,typeof(T)))).ToList();
|
||||
var shardingRouteUnits = dataSourceRouteResult.IntersectDataSources.SelectMany(dataSourceName=>filterTails.Select(tail=> new TableRouteUnit(dataSourceName,tail,typeof(T)))).ToList();
|
||||
return shardingRouteUnits;
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,7 @@ namespace ShardingCore.Core.VirtualRoutes.TableRoutes.Abstractions
|
|||
if (filterTails.IsEmpty()||filterTails.Count!=hintTails.Count)
|
||||
throw new ShardingCoreException(
|
||||
$" sharding route hint error:[{EntityMetadata.EntityType.FullName}]-->[{string.Join(",",hintTails)}]");
|
||||
var shardingRouteUnits = dataSourceRouteResult.IntersectDataSources.SelectMany(dataSourceName=>filterTails.Select(tail=> new ShardingRouteUnit(dataSourceName,tail,typeof(T)))).ToList();
|
||||
var shardingRouteUnits = dataSourceRouteResult.IntersectDataSources.SelectMany(dataSourceName=>filterTails.Select(tail=> new TableRouteUnit(dataSourceName,tail,typeof(T)))).ToList();
|
||||
return GetFilterTableTails(dataSourceRouteResult, shardingRouteUnits);
|
||||
}
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ namespace ShardingCore.Core.VirtualRoutes.TableRoutes.Abstractions
|
|||
/// <param name="dataSourceRouteResult"></param>
|
||||
/// <param name="shardingRouteUnits"></param>
|
||||
/// <returns></returns>
|
||||
private List<ShardingRouteUnit> GetFilterTableTails(DataSourceRouteResult dataSourceRouteResult, List<ShardingRouteUnit> shardingRouteUnits)
|
||||
private List<TableRouteUnit> GetFilterTableTails(DataSourceRouteResult dataSourceRouteResult, List<TableRouteUnit> shardingRouteUnits)
|
||||
{
|
||||
if (UseAssertRoute)
|
||||
{
|
||||
|
@ -106,7 +106,7 @@ namespace ShardingCore.Core.VirtualRoutes.TableRoutes.Abstractions
|
|||
out ICollection<ITableRouteAssert> routeAsserts) &&
|
||||
routeAsserts.IsNotEmpty();
|
||||
|
||||
private void ProcessAssertRoutes(DataSourceRouteResult dataSourceRouteResult,List<ShardingRouteUnit> shardingRouteUnits)
|
||||
private void ProcessAssertRoutes(DataSourceRouteResult dataSourceRouteResult,List<TableRouteUnit> shardingRouteUnits)
|
||||
{
|
||||
if (UseAssertRoute)
|
||||
{
|
||||
|
@ -120,7 +120,7 @@ namespace ShardingCore.Core.VirtualRoutes.TableRoutes.Abstractions
|
|||
}
|
||||
}
|
||||
|
||||
protected abstract List<ShardingRouteUnit> DoRouteWithPredicate(DataSourceRouteResult dataSourceRouteResult, IQueryable queryable);
|
||||
protected abstract List<TableRouteUnit> DoRouteWithPredicate(DataSourceRouteResult dataSourceRouteResult, IQueryable queryable);
|
||||
|
||||
|
||||
/// <summary>
|
||||
|
@ -129,7 +129,7 @@ namespace ShardingCore.Core.VirtualRoutes.TableRoutes.Abstractions
|
|||
/// <param name="dataSourceRouteResult">所有的数据源</param>
|
||||
/// <param name="shardingRouteUnits">所有的物理表</param>
|
||||
/// <returns></returns>
|
||||
protected virtual List<ShardingRouteUnit> AfterShardingRouteUnitFilter(DataSourceRouteResult dataSourceRouteResult, List<ShardingRouteUnit> shardingRouteUnits)
|
||||
protected virtual List<TableRouteUnit> AfterShardingRouteUnitFilter(DataSourceRouteResult dataSourceRouteResult, List<TableRouteUnit> shardingRouteUnits)
|
||||
{
|
||||
return shardingRouteUnits;
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ namespace ShardingCore.Core.VirtualRoutes.TableRoutes.Abstractions
|
|||
/// <param name="allPhysicTables"></param>
|
||||
/// <param name="queryable"></param>
|
||||
/// <returns></returns>
|
||||
protected override List<ShardingRouteUnit> DoRouteWithPredicate(DataSourceRouteResult dataSourceRouteResult, IQueryable queryable)
|
||||
protected override List<TableRouteUnit> DoRouteWithPredicate(DataSourceRouteResult dataSourceRouteResult, IQueryable queryable)
|
||||
{
|
||||
//获取路由后缀表达式
|
||||
var routeParseExpression = ShardingUtil.GetRouteParseExpression(queryable, EntityMetadata, GetRouteFilter,true);
|
||||
|
@ -35,7 +35,7 @@ namespace ShardingCore.Core.VirtualRoutes.TableRoutes.Abstractions
|
|||
var sqlRouteUnits = dataSourceRouteResult.IntersectDataSources.SelectMany(dataSourceName=>
|
||||
GetTails()
|
||||
.Where(o=>filter(FormatTableRouteWithDataSource(dataSourceName,o)))
|
||||
.Select(tail=>new ShardingRouteUnit(dataSourceName,tail,typeof(TEntity)))
|
||||
.Select(tail=>new TableRouteUnit(dataSourceName,tail,typeof(TEntity)))
|
||||
).ToList();
|
||||
|
||||
return sqlRouteUnits;
|
||||
|
@ -71,7 +71,7 @@ namespace ShardingCore.Core.VirtualRoutes.TableRoutes.Abstractions
|
|||
throw new NotImplementedException(shardingPropertyName);
|
||||
}
|
||||
|
||||
public override ShardingRouteUnit RouteWithValue(DataSourceRouteResult dataSourceRouteResult, object shardingKey)
|
||||
public override TableRouteUnit RouteWithValue(DataSourceRouteResult dataSourceRouteResult, object shardingKey)
|
||||
{
|
||||
if (dataSourceRouteResult.IntersectDataSources.Count !=1)
|
||||
{
|
||||
|
@ -87,7 +87,7 @@ namespace ShardingCore.Core.VirtualRoutes.TableRoutes.Abstractions
|
|||
|
||||
if (filterTails.Count > 1)
|
||||
throw new ShardingCoreException($"more than one route match table:{string.Join(",", filterTails)}");
|
||||
return new ShardingRouteUnit(dataSourceRouteResult.IntersectDataSources.First(), filterTails[0],typeof(TEntity));
|
||||
return new TableRouteUnit(dataSourceRouteResult.IntersectDataSources.First(), filterTails[0],typeof(TEntity));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ namespace ShardingCore.Core.VirtualRoutes.TableRoutes.Abstractions
|
|||
/// <param name="queryable"></param>
|
||||
/// <param name="isQuery"></param>
|
||||
/// <returns></returns>
|
||||
public abstract List<ShardingRouteUnit> RouteWithPredicate(DataSourceRouteResult dataSourceRouteResult, IQueryable queryable,bool isQuery);
|
||||
public abstract List<TableRouteUnit> RouteWithPredicate(DataSourceRouteResult dataSourceRouteResult, IQueryable queryable,bool isQuery);
|
||||
|
||||
/// <summary>
|
||||
/// 根据值路由
|
||||
|
@ -77,7 +77,7 @@ namespace ShardingCore.Core.VirtualRoutes.TableRoutes.Abstractions
|
|||
/// <param name="dataSourceRouteResult"></param>
|
||||
/// <param name="shardingKey"></param>
|
||||
/// <returns></returns>
|
||||
public abstract ShardingRouteUnit RouteWithValue(DataSourceRouteResult dataSourceRouteResult, object shardingKey);
|
||||
public abstract TableRouteUnit RouteWithValue(DataSourceRouteResult dataSourceRouteResult, object shardingKey);
|
||||
/// <summary>
|
||||
/// 返回数据库现有的尾巴
|
||||
/// </summary>
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace ShardingCore.Core.VirtualRoutes.TableRoutes
|
|||
/// <param name="queryable"></param>
|
||||
/// <param name="isQuery"></param>
|
||||
/// <returns></returns>
|
||||
List<ShardingRouteUnit> RouteWithPredicate(DataSourceRouteResult dataSourceRouteResult,IQueryable queryable,bool isQuery);
|
||||
List<TableRouteUnit> RouteWithPredicate(DataSourceRouteResult dataSourceRouteResult,IQueryable queryable,bool isQuery);
|
||||
|
||||
/// <summary>
|
||||
/// 根据值进行路由
|
||||
|
@ -37,7 +37,7 @@ namespace ShardingCore.Core.VirtualRoutes.TableRoutes
|
|||
/// <param name="dataSourceRouteResult"></param>
|
||||
/// <param name="shardingKey"></param>
|
||||
/// <returns></returns>
|
||||
ShardingRouteUnit RouteWithValue(DataSourceRouteResult dataSourceRouteResult, object shardingKey);
|
||||
TableRouteUnit RouteWithValue(DataSourceRouteResult dataSourceRouteResult, object shardingKey);
|
||||
/// <summary>
|
||||
/// 获取所有的目前数据库存在的尾巴,仅启动时调用
|
||||
/// get all tails in the db
|
||||
|
|
|
@ -14,17 +14,17 @@ namespace ShardingCore.Core.VirtualRoutes.TableRoutes.RoutingRuleEngine
|
|||
*/
|
||||
public class TableRouteResult
|
||||
{
|
||||
public TableRouteResult(List<ShardingRouteUnit> replaceTables)
|
||||
public TableRouteResult(List<TableRouteUnit> replaceTables)
|
||||
{
|
||||
ReplaceTables = replaceTables.ToHashSet();
|
||||
HasDifferentTail = ReplaceTables.IsNotEmpty() && ReplaceTables.GroupBy(o => o.Tail).Count() != 1;
|
||||
IsEmpty = replaceTables.Count == 0;
|
||||
}
|
||||
public TableRouteResult(ShardingRouteUnit replaceTable):this(new List<ShardingRouteUnit>(){replaceTable})
|
||||
public TableRouteResult(TableRouteUnit replaceTable):this(new List<TableRouteUnit>(){replaceTable})
|
||||
{
|
||||
}
|
||||
|
||||
public ISet<ShardingRouteUnit> ReplaceTables { get; }
|
||||
public ISet<TableRouteUnit> ReplaceTables { get; }
|
||||
|
||||
public bool HasDifferentTail { get; }
|
||||
public bool IsEmpty { get; }
|
||||
|
|
|
@ -30,8 +30,8 @@ namespace ShardingCore.Core.VirtualRoutes.TableRoutes.RoutingRuleEngine
|
|||
|
||||
public ShardingRouteResult Route(TableRouteRuleContext tableRouteRuleContext)
|
||||
{
|
||||
Dictionary<string /*dataSourceName*/, Dictionary<Type /*entityType*/, ISet<ShardingRouteUnit>>> routeMaps =
|
||||
new Dictionary<string, Dictionary<Type, ISet<ShardingRouteUnit>>>();
|
||||
Dictionary<string /*dataSourceName*/, Dictionary<Type /*entityType*/, ISet<TableRouteUnit>>> routeMaps =
|
||||
new Dictionary<string, Dictionary<Type, ISet<TableRouteUnit>>>();
|
||||
var queryEntities = tableRouteRuleContext.QueryEntities;
|
||||
|
||||
|
||||
|
@ -51,15 +51,15 @@ namespace ShardingCore.Core.VirtualRoutes.TableRoutes.RoutingRuleEngine
|
|||
if (!routeMaps.ContainsKey(dataSourceName))
|
||||
{
|
||||
routeMaps.Add(dataSourceName,
|
||||
new Dictionary<Type, ISet<ShardingRouteUnit>>()
|
||||
{ { shardingEntity, new HashSet<ShardingRouteUnit>() { shardingRouteUnit } } });
|
||||
new Dictionary<Type, ISet<TableRouteUnit>>()
|
||||
{ { shardingEntity, new HashSet<TableRouteUnit>() { shardingRouteUnit } } });
|
||||
}
|
||||
else
|
||||
{
|
||||
var routeMap = routeMaps[dataSourceName];
|
||||
if (!routeMap.ContainsKey(shardingEntity))
|
||||
{
|
||||
routeMap.Add(shardingEntity, new HashSet<ShardingRouteUnit>() { shardingRouteUnit });
|
||||
routeMap.Add(shardingEntity, new HashSet<TableRouteUnit>() { shardingRouteUnit });
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -51,13 +51,14 @@ namespace ShardingCore.Core.VirtualRoutes.TableRoutes
|
|||
return _tableRoutes.TryAdd(route.EntityMetadata.EntityType, route);
|
||||
}
|
||||
|
||||
public List<ShardingRouteUnit> RouteTo(Type entityType, ShardingTableRouteConfig shardingTableRouteConfig)
|
||||
public List<TableRouteUnit> RouteTo(Type entityType, ShardingTableRouteConfig shardingTableRouteConfig)
|
||||
{
|
||||
|
||||
var dataSourceRouteResult = new DataSourceRouteResult(_virtualDataSource.DefaultDataSourceName);
|
||||
return RouteTo(entityType, dataSourceRouteResult, shardingTableRouteConfig);
|
||||
}
|
||||
|
||||
public List<ShardingRouteUnit> RouteTo(Type entityType, DataSourceRouteResult dataSourceRouteResult,
|
||||
public List<TableRouteUnit> RouteTo(Type entityType, DataSourceRouteResult dataSourceRouteResult,
|
||||
ShardingTableRouteConfig tableRouteConfig)
|
||||
{
|
||||
var route = GetRoute(entityType);
|
||||
|
@ -84,7 +85,7 @@ namespace ShardingCore.Core.VirtualRoutes.TableRoutes
|
|||
if (shardingKeyValue == null)
|
||||
throw new ShardingCoreException(" route entity queryable or sharding key value is null ");
|
||||
var shardingRouteUnit = route.RouteWithValue(dataSourceRouteResult, shardingKeyValue);
|
||||
return new List<ShardingRouteUnit>(1) { shardingRouteUnit };
|
||||
return new List<TableRouteUnit>(1) { shardingRouteUnit };
|
||||
}
|
||||
}
|
||||
}
|
|
@ -2,6 +2,7 @@ using System.Collections.Generic;
|
|||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using ShardingCore.Core;
|
||||
using ShardingCore.Core.RuntimeContexts;
|
||||
|
||||
namespace ShardingCore.EFCores.OptionsExtensions
|
||||
{
|
||||
|
|
|
@ -9,6 +9,7 @@ using System.Threading;
|
|||
using System.Threading.Tasks;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using ShardingCore.Core.EntityMetadatas;
|
||||
using ShardingCore.Core.RuntimeContexts;
|
||||
using ShardingCore.Core.VirtualDatabase.VirtualDataSources;
|
||||
using ShardingCore.Core.VirtualRoutes.Abstractions;
|
||||
using ShardingCore.Extensions;
|
||||
|
|
|
@ -9,6 +9,7 @@ using Microsoft.Extensions.DependencyInjection;
|
|||
using Microsoft.Extensions.Logging;
|
||||
using ShardingCore.Core;
|
||||
using ShardingCore.Core.EntityMetadatas;
|
||||
using ShardingCore.Core.RuntimeContexts;
|
||||
using ShardingCore.Core.VirtualRoutes.TableRoutes.RouteTails.Abstractions;
|
||||
using ShardingCore.Logger;
|
||||
using ShardingCore.Sharding.Abstractions;
|
||||
|
|
|
@ -11,6 +11,7 @@ using System.Linq.Expressions;
|
|||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using ShardingCore.Core;
|
||||
using ShardingCore.Core.RuntimeContexts;
|
||||
|
||||
|
||||
namespace ShardingCore.EFCores
|
||||
|
|
|
@ -15,6 +15,7 @@ using Microsoft.Extensions.Caching.Memory;
|
|||
using Microsoft.Extensions.DependencyInjection;
|
||||
using ShardingCore.Core;
|
||||
using ShardingCore.Core.EntityMetadatas;
|
||||
using ShardingCore.Core.RuntimeContexts;
|
||||
using ShardingCore.EFCores;
|
||||
using ShardingCore.Exceptions;
|
||||
using ShardingCore.Utils;
|
||||
|
|
|
@ -9,6 +9,7 @@ using Microsoft.EntityFrameworkCore.Internal;
|
|||
using Microsoft.EntityFrameworkCore.Query;
|
||||
using Microsoft.EntityFrameworkCore.Query.Internal;
|
||||
using ShardingCore.Core;
|
||||
using ShardingCore.Core.RuntimeContexts;
|
||||
using ShardingCore.EFCores.OptionsExtensions;
|
||||
using ShardingCore.Sharding.Abstractions;
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ using System.Text;
|
|||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using ShardingCore.Core;
|
||||
using ShardingCore.Core.RuntimeContexts;
|
||||
using ShardingCore.Core.VirtualRoutes.DataSourceRoutes.RouteRuleEngine;
|
||||
using ShardingCore.Core.VirtualRoutes.TableRoutes;
|
||||
using ShardingCore.Core.VirtualRoutes.TableRoutes.RouteTails.Abstractions;
|
||||
|
|
|
@ -4,6 +4,7 @@ using System.Linq;
|
|||
using System.Text;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using ShardingCore.Core;
|
||||
using ShardingCore.Core.RuntimeContexts;
|
||||
using ShardingCore.Sharding.Abstractions;
|
||||
using ShardingCore.Sharding.ReadWriteConfigurations;
|
||||
using ShardingCore.Sharding.ReadWriteConfigurations.Abstractions;
|
||||
|
|
|
@ -11,6 +11,7 @@ using Microsoft.EntityFrameworkCore.Migrations;
|
|||
using Microsoft.EntityFrameworkCore.Migrations.Operations;
|
||||
using Microsoft.EntityFrameworkCore.Storage;
|
||||
using ShardingCore.Core;
|
||||
using ShardingCore.Core.RuntimeContexts;
|
||||
using ShardingCore.Extensions;
|
||||
using ShardingCore.Sharding.Abstractions;
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ using System.Threading.Tasks;
|
|||
using Microsoft.EntityFrameworkCore;
|
||||
using ShardingCore.Core;
|
||||
using ShardingCore.Core.QueryTrackers;
|
||||
using ShardingCore.Core.RuntimeContexts;
|
||||
using ShardingCore.Extensions;
|
||||
using ShardingCore.Sharding.Abstractions;
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||
using Microsoft.EntityFrameworkCore;
|
||||
using ShardingCore.Core;
|
||||
using ShardingCore.Core.QueryTrackers;
|
||||
using ShardingCore.Core.RuntimeContexts;
|
||||
using ShardingCore.Extensions;
|
||||
using ShardingCore.Sharding.Abstractions;
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace ShardingCore.Sharding.MergeEngines.Common
|
|||
DataSourceName = dataSourceName;
|
||||
var routeResults = tableRouteResults;
|
||||
TableRouteResults = routeResults;
|
||||
TableRouteResult = new TableRouteResult(new List<ShardingRouteUnit>(0));
|
||||
TableRouteResult = new TableRouteResult(new List<TableRouteUnit>(0));
|
||||
}
|
||||
|
||||
public string DataSourceName { get; }
|
||||
|
|
|
@ -14,6 +14,7 @@ using ShardingCore.Core;
|
|||
using ShardingCore.Core.VirtualDatabase.VirtualDataSources;
|
||||
using ShardingCore.Core.VirtualRoutes.TableRoutes.RouteTails.Abstractions;
|
||||
using ShardingCore.Core.DbContextCreator;
|
||||
using ShardingCore.Core.RuntimeContexts;
|
||||
using ShardingCore.Exceptions;
|
||||
using ShardingCore.Extensions;
|
||||
using ShardingCore.Infrastructures;
|
||||
|
|
|
@ -11,6 +11,7 @@ using ShardingCore.Core.EntityMetadatas;
|
|||
using ShardingCore.Core.VirtualDatabase.VirtualDataSources;
|
||||
using ShardingCore.Core.VirtualRoutes.TableRoutes.RouteTails.Abstractions;
|
||||
using ShardingCore.Core.DbContextCreator;
|
||||
using ShardingCore.Core.RuntimeContexts;
|
||||
using ShardingCore.Core.VirtualRoutes.Abstractions;
|
||||
using ShardingCore.Extensions;
|
||||
using ShardingCore.Sharding.Abstractions;
|
||||
|
|
|
@ -7,6 +7,7 @@ using System.Threading.Tasks;
|
|||
using Microsoft.EntityFrameworkCore;
|
||||
using ShardingCore.Core;
|
||||
using ShardingCore.Core.EntityMetadatas;
|
||||
using ShardingCore.Core.RuntimeContexts;
|
||||
using ShardingCore.Core.VirtualDatabase.VirtualDataSources;
|
||||
using ShardingCore.Core.VirtualRoutes;
|
||||
using ShardingCore.Core.VirtualRoutes.DataSourceRoutes.RouteRuleEngine;
|
||||
|
|
|
@ -10,6 +10,7 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using ShardingCore.Core;
|
||||
using ShardingCore.Core.RuntimeContexts;
|
||||
using ShardingCore.Sharding.Parsers;
|
||||
using ShardingCore.Sharding.Parsers.Abstractions;
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using ShardingCore.Core.RuntimeContexts;
|
||||
using ShardingCore.Core.VirtualRoutes;
|
||||
using ShardingCore.Sharding.MergeEngines.Abstractions;
|
||||
using ShardingCore.Sharding.MergeEngines.Common.Abstractions;
|
||||
|
|
|
@ -37,7 +37,6 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Core\RuntimeModels" />
|
||||
<Folder Include="Sharding\Visitors\GroupBys" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
|
|
@ -29,6 +29,7 @@ using ShardingCore.Bootstrappers;
|
|||
using ShardingCore.Core;
|
||||
using ShardingCore.Core.DbContextCreator;
|
||||
using ShardingCore.Core.QueryTrackers;
|
||||
using ShardingCore.Core.RuntimeContexts;
|
||||
using ShardingCore.Core.ShardingConfigurations.ConfigBuilders;
|
||||
using ShardingCore.Core.UnionAllMergeShardingProviders;
|
||||
using ShardingCore.Core.UnionAllMergeShardingProviders.Abstractions;
|
||||
|
|
|
@ -3,6 +3,7 @@ using Microsoft.EntityFrameworkCore;
|
|||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using ShardingCore.Core;
|
||||
using ShardingCore.Core.RuntimeContexts;
|
||||
using ShardingCore.Core.ShardingConfigurations;
|
||||
using ShardingCore.Core.ShardingConfigurations.Abstractions;
|
||||
using ShardingCore.Sharding.Abstractions;
|
||||
|
|
Loading…
Reference in New Issue