Beispiel #1
0
 internal static void TestCreateModifyDeleteCustomer()
 {
     NwDao.InsertCustomer("cus1", "myCompany1");
     NwDao.ShowCustomer("cus1");
     NwDao.UpdateCustomer("cus1", "myCompany1Edited", "myAddress1", "myCity1", "country1");
     NwDao.ShowCustomer("cus1");
     NwDao.DeleteCustomer("cus1");
     NwDao.ShowCustomer("cus1");
 }
Beispiel #2
0
        private static void ParallelUpdate()
        {
            // every time we run this method we`ll get different final result for
            // company name. To correct this behaviour we need to implement transactions
            // or use somekind of locking mechanism inside c# code
            NwDao.DeleteCustomer("Par1");
            NwDao.InsertCustomer("Par1", "par1");

            Parallel.For(0, 20, x => NwDao.UpdateCustomer("Par1", "par1update " + x, "", "", ""));

            Console.WriteLine("Result after simultaneous updating customer with id='Par1' with new company name = 'old name' + [1-20]");
            NwDao.ShowCustomer("Par1");
            NwDao.DeleteCustomer("Par1");
        }