Exemple #1
0
        public DatabaseContext CreateDbContext(string[] args)
        {
            var configuration = new ConfigurationBuilder()
                                .AddJsonFile("appsettings.json")
                                .Build();

            var appSettings = new AppSettings();

            configuration.GetSection("AppSettings").Bind(appSettings);

            var options = new DbContextOptionsBuilder <DatabaseContext>();

            DatabaseExtensions.ConfigureDbContextOptions(configuration, appSettings, options);

            return(new DatabaseContext(options.Options));
        }