public void InsertEntityTest() { using (var data = new SqlDataAccess(STR_ConnectionString)) { Customer customer = new Customer() { FirstName = "Mike", LastName = "Smith", Company = "Smith & Smith", Entered = DateTime.UtcNow, Updated = DateTime.UtcNow }; // insert into customers and skip Id,Order properties and return id object newId = data.InsertEntity(customer, "Customers", "Id,Orders"); Assert.IsNotNull(newId, data.ErrorMessage); Console.WriteLine(newId); } }
public void InsertEntityOleDbTest() { Console.WriteLine(connString); using (var data = new SqlDataAccess(connString, "System.Data.OleDb") { ParameterPrefix = "?", UsePositionalParameters = true, LeftFieldBracket = "", RightFieldBracket = "" }) { var customer = new { Id = StringUtils.NewStringId(), FirstName = "Mike", LastName = "Smith", Company = "Smith & Smith", Entered = DateTime.UtcNow }; // insert into customers and skip Id,Order properties and return id object newId = data.InsertEntity(customer, "Customers", null, false); Console.WriteLine(data.LastSql); Assert.IsNotNull(newId, data.ErrorMessage); Console.WriteLine(newId); } }