Пример #1
0
        private void InitLanguage(HomeConfiguration config)
        {
            var culture = config.GetCulture();

            _logger.LogInformation($"init culture: {culture}");

            Thread.CurrentThread.CurrentCulture                   =
                Thread.CurrentThread.CurrentUICulture             =
                    CultureInfo.DefaultThreadCurrentCulture       =
                        CultureInfo.DefaultThreadCurrentUICulture = culture;
        }
Пример #2
0
        //private static IServiceProvider ConfigureServices(HomeConfiguration config)
        //{
        //    var serviceCollection = new ServiceCollection();

        //    RegisterServices(serviceCollection, config);

        //    return serviceCollection.BuildServiceProvider();
        //}

        public static void RegisterServices(IServiceCollection serviceCollection, HomeConfiguration config)
        {
            var asms = config.GetDependencies().ToArray();

            serviceCollection.AddSingleton <IServiceContext, ServiceContext>();
            serviceCollection.AddSingleton(config.Configuration.GetSection("plugins"));

            foreach (var asm in asms)
            {
                AddAssemblyPlugins(serviceCollection, asm);
            }
        }
        public static void AddPluginsService(this IServiceCollection services, IConfiguration configuration)
        {
            var config = new HomeConfiguration(configuration);

            HomeApplication.RegisterServices(services, config);
        }