Пример #1
0
        public Contexto CreateDbContext(string[] args)
        {
            var configuration    = Configuracao.GetConfiguration(Directory.GetCurrentDirectory());
            var connectionString = configuration.GetConnectionString("DefaultConnection");

            if (connectionString == null)
            {
                connectionString = "Server=localhost;Port=5432;Database=citiwide;User Id=postgres;Password=lugo2012;Enlist=true;Integrated Security = true";
            }

            var optionsBuilder = new DbContextOptionsBuilder <Contexto>();

            optionsBuilder.UseMySQL(connectionString);
            return(Contexto.Create(optionsBuilder.Options));
        }