Exemplo n.º 1
0
        private async void cbDataBases_TextChanged(object sender, EventArgs e)
        {
            var config   = Program.AppConfiguration;
            var dataBase = cbxDataBases.Text;

            if (!string.IsNullOrWhiteSpace(dataBase))
            {
                if (config.ActiveDb != dataBase)
                {
                    config.ActiveDb = dataBase;
                    AppSettings.SaveConfiguration(config);
                }
                gbOtherConfigurations.Enabled     = false;
                gbNeuralNodeConfiguration.Enabled = false;
                cbxChatProfiles.Enabled           = false;
                MongoDbProvider.Connect(config.DbConnections[dataBase]);
                await SyncChatProfile();
                await LoadChatProfiles();

                gbOtherConfigurations.Enabled = true;
                cbxChatProfiles.Enabled       = true;
            }
        }
Exemplo n.º 2
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            var configuration = new ConfigurationBuilder()
                                .SetBasePath(webHostEnv.ContentRootPath)
                                .AddJsonFile(AppSettingsFile, true, true)
                                .AddEnvironmentVariables().Build();

            services.AddSingleton(configuration);

            var connectionString = configuration.GetValue <string>("MongoDbConnectionString");

            MongoDbProvider.Connect(connectionString);

            services.AddBot <BotAlpha>(options =>
            {
                options.CredentialProvider = new ConfigurationCredentialProvider(configuration);
            });

            services.AddSingleton(ConfigureLog4Net());

            services.AddPredictionEnginePool <NeuralTrainInput, PredictionOutput>()
            .FromFile(modelName: nameof(NeuralPredictionEngine), filePath: NeuralPredictionEngine.ModelFilePath, watchForChanges: true);
        }
Exemplo n.º 3
0
 private static void ConnectToDatabase()
 {
     MongoDbProvider.Connect(AppConfiguration.GetActiveDbConnectionString());
 }