public static void EnsureSeeded(this STH.FingopayApp.DemoApiContext context) { if (!context.Accounts.Any()) { var accounts = JsonConvert.DeserializeObject <List <Account> >(File.ReadAllText("seed" + Path.DirectorySeparatorChar + "accounts.json")); context.AddRange(accounts); context.SaveChanges(); } //Ensure we have some status if (!context.Users.Any()) { var stati = JsonConvert.DeserializeObject <List <User> >(File.ReadAllText(@"seed" + Path.DirectorySeparatorChar + "users.json")); context.AddRange(stati); context.SaveChanges(); } }
public UnitOfWork(STH.FingopayApp.DemoApiContext context) { Context = context; _disposed = false; }