public static void EnsureDataSeed(this StoriesDbContext db) { if (!db.Set <Administrator>().Any()) { var user = new User() { FirstName = "Admin", Nickname = "Admin", Username = "******", PasswordHash = StringHelpers.ComputeHash("12345", "12345"), Roles = new List <Role> { new Administrator() }, Salt = "12345", Registered = DateTime.UtcNow }; db.Set <User>().Add(user); db.SaveChanges(); } }
public DbContextTransactionFilter(StoriesDbContext db) { _db = db; }