public static HbrClientDbContext CreateContext(this Context c) { if (_context == null) { var context = (HbrClientDbContext)Activator.CreateInstance(typeof(HbrClientDbContext)); context.Database.EnsureCreated(); context.Database.Migrate(); _context = context; } return(_context); }
public static async Task <HbrClientDbContext> CreateContextAsync(this Context c) { if (_context == null) { var context = (HbrClientDbContext)Activator.CreateInstance(typeof(HbrClientDbContext)); await context.Database.EnsureCreatedAsync(); await context.Database.MigrateAsync(); _context = context; } return(_context); }