Ejemplo n.º 1
0
        private static DbContextOptions <TypiconDBContext> CreateOptions()
        {
            var optionsBuilder = new DbContextOptionsBuilder <TypiconDBContext>();

            //MSSql
            //DbOptions.CofigureMsSql(optionsBuilder);

            //Sqlite
            DbOptions.CofigureSqlite(optionsBuilder);

            //PostgreSQL
            //DbOptions.CofigurePostgre(optionsBuilder);

            //MySQL
            //DbOptions.CofigureMySql(optionsBuilder);

            return(optionsBuilder.Options);
        }
Ejemplo n.º 2
0
        private static DbContextOptions <TypiconDBContext> CreateOptions()
        {
            var optionsBuilder = new DbContextOptionsBuilder <TypiconDBContext>();

            IConfiguration config = new ConfigurationBuilder()
                                    .AddJsonFile("appsettings.json", true, true)
                                    .Build();

            //MSSql
            //DbOptions.ConfigureMsSql(optionsBuilder);

            //Sqlite
            //DbOptions.ConfigureSqlite(optionsBuilder, config);

            //PostgreSQL
            //DbOptions.ConfigurePostgre(optionsBuilder);

            //MySQL
            DbOptions.ConfigureMySql(optionsBuilder, config);

            return(optionsBuilder.Options);
        }