private static void AddEntitiesToMultipleContexts( IServiceProvider serviceProvider, string dbName1, string dbName2) { using var context1 = new BronieContext(serviceProvider, dbName1); using var context2 = new BronieContext(serviceProvider, dbName2); for (var i = 0; i < 29; i++) { context1.Add( new Pegasus { Name = "Rainbow Dash " + i }); context2.Add( new Pegasus { Name = "Fluttershy " + i }); context1.Add( new Pegasus { Name = "Fluttershy " + i }); } context1.SaveChanges(); context2.SaveChanges(); }
private static void AddEntities(IServiceProvider serviceProvider) { using (var context = new BronieContext(serviceProvider, "Bronies")) { for (var i = 0; i < 10; i++) { context.Add(new Pegasus { Name = "Rainbow Dash " + i }); context.Add(new Pegasus { Name = "Fluttershy " + i }); } context.SaveChanges(); } }
private static void AddEntities(IServiceProvider serviceProvider, string name) { using (var context = new BronieContext(serviceProvider, name)) { for (var i = 0; i < 10; i++) { context.Add( new Pegasus { Name = "Rainbow Dash " + i }); context.Add( new Pegasus { Name = "Fluttershy " + i }); } context.SaveChanges(); } }
private static void AddEntitiesWithIds(IServiceProvider serviceProvider, int idOffset, string name) { using (var context = new BronieContext(serviceProvider, name)) { for (var i = 1; i < 11; i++) { context.Add( new Pegasus { Name = "Rainbow Dash " + i, Identifier = i * 100 + idOffset }); context.Add( new Pegasus { Name = "Fluttershy " + i, Identifier = i * 100 + idOffset + 1 }); } context.SaveChanges(); } }
private static void AddEntitiesWithIds(IServiceProvider serviceProvider, int idOffset) { using (var context = new BronieContext(serviceProvider, "ExplicitBronies")) { for (var i = 1; i < 11; i++) { context.Add(new Pegasus { Name = "Rainbow Dash " + i, Identifier = i * 100 + idOffset }); context.Add(new Pegasus { Name = "Fluttershy " + i, Identifier = i * 100 + idOffset + 1 }); } context.SaveChanges(); } }