Example #1
0
        /// <summary>
        /// 获取远程租户参数
        /// </summary>
        /// <param name="builder"></param>
        /// <param name="endpointTemplate"></param>
        /// <param name="clientConfig"></param>
        /// <returns></returns>
        public static MultiTenantBuilder WithHttpRemoteStore(
            this MultiTenantBuilder builder,
            string endpointTemplate,
            Action <IHttpClientBuilder> clientConfig)
        {
            var httpClientBuilder = builder.Services.AddHttpClient(typeof(HttpRemoteStoreClient).FullName);

            if (clientConfig != null)
            {
                clientConfig(httpClientBuilder);
            }

            builder.Services.TryAddSingleton <HttpRemoteStoreClient>();
            return(builder.WithStore <HttpRemoteStore>(ServiceLifetime.Singleton, endpointTemplate));
        }
Example #2
0
 /// <summary>
 /// 配置文件参数存储
 /// </summary>
 /// <param name="builder"></param>
 /// <param name="configuration"></param>
 /// <param name="sectionName">节点名称</param>
 /// <returns></returns>
 public static MultiTenantBuilder WithConfigurationStore(
     this MultiTenantBuilder builder,
     IConfiguration configuration,
     string sectionName)
 => builder.WithStore <ConfigurationStore>(ServiceLifetime.Singleton, configuration, sectionName);
Example #3
0
 /// <summary>
 /// 配置文件参数存储
 /// </summary>
 /// <param name="builder"></param>
 /// <returns></returns>
 public static MultiTenantBuilder WithConfigurationStore(this MultiTenantBuilder builder)
 => builder.WithStore <ConfigurationStore>(ServiceLifetime.Singleton);