internal static void Bind(IServiceCollection services, IConfiguration configuration) { ConfigurationUnity.Bind <GlobalConfigurationSection>(configuration); ConfigurationUnity.Bind <ProviderConfigurationSection>(configuration); ConfigurationUnity.Bind <ConverterConfigurationSection>(configuration); ConfigurationUnity.Bind <InstanceConfigurationSection>(configuration); }
internal static void Bind(IServiceCollection services, IConfiguration configuration) { ConfigurationUnity.Bind <LoggingConfigurationSection>(configuration); ConfigurationUnity.Bind <CachingConfigurationSection>(configuration); ConfigurationUnity.Bind <ContainerConfigurationSection>(configuration); services.AddSingleton(typeof(ILogger), s => LoggerFactory.CreateLogger()); services.AddSingleton(typeof(ICacheManager), s => CacheManagerFactory.CreateManager()); }
/// <summary> /// 使 <see cref="IServiceCollection"/> 能够使用 Fireasy 框架中的配置。 /// </summary> /// <param name="services"></param> /// <param name="configuration"></param> /// <returns></returns> public static IServiceCollection AddFireasy(this IServiceCollection services, IConfiguration configuration, Action <Fireasy.Common.CoreOptions> setupAction = null) { ConfigurationUnity.Bind(Assembly.GetCallingAssembly(), configuration, services); var options = new Fireasy.Common.CoreOptions(); setupAction?.Invoke(options); return(services); }
public static void Init() { #if NETCOREAPP var config = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true) .Build(); ConfigurationUnity.Bind(typeof(InitConfig).Assembly, config); #endif }
internal static void Bind(IServiceCollection services, IConfiguration configuration) { try { ConfigurationUnity.Bind <TranslatorConfigurationSection>(configuration); } catch (Exception exp) { Tracer.Error($"{typeof(ConfigurationBinder).FullName} throw exception when binding:{exp.Output()}"); } }
internal static void Bind(IServiceCollection services, IConfiguration configuration) { ConfigurationUnity.Bind <LoggingConfigurationSection>(configuration); ConfigurationUnity.Bind <CachingConfigurationSection>(configuration); ConfigurationUnity.Bind <ContainerConfigurationSection>(configuration); ConfigurationUnity.Bind <SubscribeConfigurationSection>(configuration); ConfigurationUnity.Bind <ImportConfigurationSection>(configuration); if (services != null) { services.AddLogger().AddCaching().AddSubscriber(); } }
internal static void Bind(IServiceCollection services, IConfiguration configuration) { ConfigurationUnity.Bind <LoggingConfigurationSection>(configuration); ConfigurationUnity.Bind <CachingConfigurationSection>(configuration); ConfigurationUnity.Bind <ContainerConfigurationSection>(configuration); ConfigurationUnity.Bind <SubscribeConfigurationSection>(configuration); if (services != null) { services.AddSingleton(typeof(ILogger), s => LoggerFactory.CreateLogger()); services.AddSingleton(typeof(ICacheManager), s => CacheManagerFactory.CreateManager()); services.AddSingleton(typeof(ISubscribeManager), s => SubscribeManagerFactory.CreateManager()); services.AddSingleton(typeof(ITextSerializer), s => SerializerFactory.CreateSerializer()); } }
internal static void Bind(IServiceCollection services, IConfiguration configuration) { ConfigurationUnity.Bind <TranslatorConfigurationSection>(configuration); }