public void InitializeDatabase(ConcretarContext context)
        {
            bool dbExists;

            dbExists = context.Database.EnsureCreated();

            /*if (dbExists)
             * {
             *  try
             *  {
             *      if (!context.Database.CompatibleWithModel(true))
             *      {
             *          throw new Exception("La base de datos existe y no es compatible...");
             *      }
             *  }
             *  catch
             *  {
             *      return;
             *  }
             * }
             * else
             * {
             *  context.Database.Create();
             *  context.SaveChanges();
             *  nueva = true;
             *  return;
             * }*/
            return;
        }
Exemple #2
0
        public UnitOfWork()
        {
            var builder = new DbContextOptionsBuilder <ConcretarContext>();

            builder.UseSqlServer(DbConfig.Conexion.GetConnectionString("DefaultConnection"));

            // Stop client query evaluation
            builder.ConfigureWarnings(w => w.Throw(RelationalEventId.QueryClientEvaluationWarning));
            context = new ConcretarContext(builder.Options);
        }
        protected void Seed(ConcretarContext context)

        {
        }
 public void CreateUser(ConcretarContext context)
 {
 }