public void InsertSimpleClass() { var options = new UniqueDbConnectionProviderOptions("ws2012sqlexp1\\sqlexpress", "autodisposedatabase"); var connectionProvider = new UniqueDbConnectionProvider(options); "After creating a database" ._(() => connectionProvider.CreateDatabase()); using (var lifecycle = connectionProvider.ToSelfDeletingDisposable()) { BddStringExtensions._("Create the table", () => { connectionProvider.EnsureTableExists <SimpleClass>("dbo", "SimpleClass"); }); BddStringExtensions._("Insert into the table", () => { connectionProvider.Insert(SimpleClass.GetSample(), "SimpleClass"); }); } }
public void SlowBulkInsertSimpleClass() { var options = new UniqueDbConnectionProviderOptions("ws2012sqlexp1\\sqlexpress", "autodisposedatabase"); var connectionProvider = new UniqueDbConnectionProvider(options); "After creating a database" ._(() => connectionProvider.CreateDatabase()); using (var lifecycle = connectionProvider.ToSelfDeletingDisposable()) { BddStringExtensions._("Create the table", () => { connectionProvider.EnsureTableExists <SimpleClass>("dbo", "SimpleClass"); }); BddStringExtensions._("Insert into the table", () => { var listOfSimpleClass = Enumerable.Range(0, 1000).Select(i => SimpleClass.GetSample()).ToList(); foreach (var simpleClass in listOfSimpleClass) { connectionProvider.Insert(simpleClass, "SimpleClass"); } }); } }