修改根命名空间,修改分库配置。
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
using ConsoleApp2.HostedServices;
|
||||
using MesETL.App.HostedServices;
|
||||
|
||||
namespace ConsoleApp2.Options
|
||||
namespace MesETL.App.Options
|
||||
{
|
||||
public class DataInputOptions
|
||||
{
|
||||
|
@@ -1,8 +1,6 @@
|
||||
using ConsoleApp2.Cache;
|
||||
using ConsoleApp2.HostedServices;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using MesETL.App.HostedServices;
|
||||
|
||||
namespace ConsoleApp2.Options;
|
||||
namespace MesETL.App.Options;
|
||||
|
||||
public enum ColumnType
|
||||
{
|
||||
|
@@ -1,4 +1,4 @@
|
||||
namespace ConsoleApp2.Options;
|
||||
namespace MesETL.App.Options;
|
||||
|
||||
public class DatabaseOutputOptions
|
||||
{
|
||||
|
@@ -1,4 +1,4 @@
|
||||
namespace ConsoleApp2.Options;
|
||||
namespace MesETL.App.Options;
|
||||
|
||||
public class RedisCacheOptions
|
||||
{
|
||||
|
@@ -1,4 +1,4 @@
|
||||
namespace ConsoleApp2.Options;
|
||||
namespace MesETL.App.Options;
|
||||
|
||||
public struct TableMockConfig
|
||||
{
|
||||
|
@@ -1,21 +1,22 @@
|
||||
namespace ConsoleApp2.Options;
|
||||
namespace MesETL.App.Options;
|
||||
|
||||
public class TenantDbOptions
|
||||
{
|
||||
public string? TenantKey { get; set; }
|
||||
public string? UseDbGroup { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Key-Value: {DbName}-{TenantKeyLessThan}
|
||||
/// </summary>
|
||||
public Dictionary<string, int>? DbList { get; set; }
|
||||
public Dictionary<string, int>? DbGroup { get; set; }
|
||||
|
||||
public string GetDbNameByTenantKeyValue(int tenantKeyValue)
|
||||
{
|
||||
// var dictionary = new SortedDictionary<int, string>();
|
||||
// DbList.ForEach(pair => dictionary.Add(pair.Value, pair.Key));
|
||||
// 注意配置顺序
|
||||
if(DbList is null) throw new ApplicationException("分库配置中没有发现任何数据库");
|
||||
var dbName = DbList.Cast<KeyValuePair<string, int>?>()
|
||||
if(DbGroup is null) throw new ApplicationException("分库配置中没有发现任何数据库");
|
||||
var dbName = DbGroup.Cast<KeyValuePair<string, int>?>()
|
||||
.FirstOrDefault(pair => pair?.Value != null && pair.Value.Value > tenantKeyValue)!.Value.Key;
|
||||
return dbName ??
|
||||
throw new ArgumentOutOfRangeException(nameof(tenantKeyValue),
|
||||
|
Reference in New Issue
Block a user