增加项目,分层
This commit is contained in:
1 parent
6e995a5bdb
commit
0a3e5af6a9
234 files changed
+26994
-1
No files matched your search
@@ -0,0 +1,95 @@
|
||||
//using Autofac.Core.Registration;
|
||||
//using Autofac.Features.Indexed;
|
||||
//using MAX.Core.DependencyInjection;
|
||||
//using MAX.Core.Infrastructure;
|
||||
//using System;
|
||||
//using System.Collections.Concurrent;
|
||||
//using System.Collections.Generic;
|
||||
|
||||
//namespace Store.Client
|
||||
//{
|
||||
// /// <summary>
|
||||
// /// 从 Autofac Keyed Service 中获取服务配置。
|
||||
// /// 登录后服务端下发的新地址会保存在运行时配置中,并优先于 Keyed DI 初始配置。
|
||||
// /// </summary>
|
||||
// public sealed class ServiceConfigProvider : IServiceConfigProvider, ISingletonDependency
|
||||
// {
|
||||
// private readonly IIndex<string, IApiServerConfig> _configs;
|
||||
// private readonly ConcurrentDictionary<string, IApiServerConfig> _runtimeConfigs = new ConcurrentDictionary<string, IApiServerConfig>();
|
||||
|
||||
// public ServiceConfigProvider(IIndex<string, IApiServerConfig> configs)
|
||||
// {
|
||||
// _configs = configs ?? throw new ArgumentNullException(nameof(configs));
|
||||
// }
|
||||
|
||||
// public IApiServerConfig Get(string key)
|
||||
// {
|
||||
// if (TryGet(key, out IApiServerConfig config))
|
||||
// {
|
||||
// return config;
|
||||
// }
|
||||
|
||||
// throw new InvalidOperationException($"未注册 Key 为“{key}”的 IApiServerConfig。");
|
||||
// }
|
||||
|
||||
// public bool TryGet(string key, out IApiServerConfig config)
|
||||
// {
|
||||
// config = null;
|
||||
// if (string.IsNullOrWhiteSpace(key))
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// if (_runtimeConfigs.TryGetValue(key, out config))
|
||||
// {
|
||||
// return true;
|
||||
// }
|
||||
|
||||
// try
|
||||
// {
|
||||
// config = _configs[key];
|
||||
// return config != null;
|
||||
// }
|
||||
// catch (KeyNotFoundException)
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
// catch (ComponentNotRegisteredException)
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
|
||||
// public void Set(string key, IApiServerConfig config)
|
||||
// {
|
||||
// if (string.IsNullOrWhiteSpace(key))
|
||||
// {
|
||||
// throw new ArgumentException("服务配置 Key 不能为空。", nameof(key));
|
||||
// }
|
||||
// if (config == null)
|
||||
// {
|
||||
// throw new ArgumentNullException(nameof(config));
|
||||
// }
|
||||
|
||||
// _runtimeConfigs[key] = config;
|
||||
// }
|
||||
|
||||
// public void Set(string key, string host, string objUrl)
|
||||
// {
|
||||
// Set(key, new ServiceConfig(host, objUrl));
|
||||
// }
|
||||
|
||||
// public void SetHost(string key, string host)
|
||||
// {
|
||||
// string objUrl = TryGet(key, out IApiServerConfig config)
|
||||
// ? config.ObjUrl
|
||||
// : string.Empty;
|
||||
// Set(key, new ServiceConfig(host, objUrl));
|
||||
// }
|
||||
|
||||
// public bool Remove(string key)
|
||||
// {
|
||||
// return !string.IsNullOrWhiteSpace(key) && _runtimeConfigs.TryRemove(key, out _);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
Reference in new issue
Block a user