private static void SeedExamples(ExampleContext context) { if (!context.Examples.Any()) { context.Add(new Example() { CreatedDate = DateTime.Now, Name = "First example" }); context.Add(new Example() { CreatedDate = DateTime.Now, Name = "Second example" }); context.SaveChanges(); } }
public ExampleRepository(ExampleContext context) : base(context) { this.context = context; }
public static void InitializeForProduction(ExampleContext context) { context.Database.EnsureCreated(); SeedExamples(context); }
public static void InitializeForDevelopment(ExampleContext context) { context.Database.EnsureCreated(); SeedExamples(context); }
public Repository(ExampleContext context) { this.context = context; }