Esempio n. 1
0
 private static void Migrate(this GatewayDbContext context)
 {
     context.Database.EnsureCreated();
     if (context.Database.GetPendingMigrations().Any())
     {
         context.Database.Migrate();
     }
 }
Esempio n. 2
0
        internal static Tuple <Client, GatewayDbContext> AddDefaultClient(this GatewayDbContext dbContext)
        {
            var defaultClient = dbContext.Clients
                                .Include(c => c.UserAccounts)
                                .FirstOrDefault(c => c.Name == DefaultClientName);

            if (defaultClient == null)
            {
                defaultClient = new Client {
                    Name = DefaultClientName
                };
                dbContext.Add(defaultClient);
            }

            dbContext.SaveChanges();

            return(new Tuple <Client, GatewayDbContext>(defaultClient, dbContext));
        }
Esempio n. 3
0
 private static void Seed(this GatewayDbContext context)
 {
     context.AddDefaultClient().AddDefaultClientLogin();
     context.SaveChanges();
 }