private static void TestCreateOperation(Database db, Container newContainer) { // CREATE Console.WriteLine("tallennetaan: {0} - {1}, {2}", newContainer.ContainerId, newContainer.Modificator, newContainer.ModificationDate); db.Insert("Container", "ContainerId", false, newContainer); Console.WriteLine("tallennettu: {0} - {1}, {2}", newContainer.ContainerId, newContainer.Modificator, newContainer.ModificationDate); Console.WriteLine(); }
private static void TestDeleteOperation(Database db, Container newContainer) { Console.WriteLine("poistetaan: {0} - {1}, {2}", newContainer.ContainerId, newContainer.Modificator, newContainer.ModificationDate); db.Delete("Container", "ContainerId", newContainer); Console.WriteLine("poistettu: {0} - {1}, {2}", newContainer.ContainerId, newContainer.Modificator, newContainer.ModificationDate); }
static void Main(string[] args) { try { // PetaPoco db-objektin luominen, tämän läpi tehdään kaikki jännä var db = new PetaPoco.Database("hep"); // connection stringin nimi parameetterinä BasicQuery(db); TransactionTest(db); UspQuery(db); var herd = 1505147; DateTime? date = DateTime.Now; DynamicSql(db, herd, date); var newContainer = new Container { ContainerId = 59004, Modificator = "JukkaA", ModificationDate = DateTime.Now }; TestMARS(db); TestMapping(db); TestCreateOperation(db, newContainer); TestDeleteOperation(db, newContainer); TestPaging(db, herd, date); } catch (Exception ex) { Console.WriteLine(ex); } Console.ReadKey(); }