public static void Initialize(IServiceProvider serviceProvider) { using (var context = new KeyContext(serviceProvider.GetRequiredService <DbContextOptions <KeyContext> >())) { if (context.Keys.Any()) { return; } context.Keys.AddRange( new Key { KeyId = 1, Name = "C" }, new Key { KeyId = 2, Name = "A" } ); context.SaveChanges(); } }
public void Configure(KeyContext keyContext) { }