Beispiel #1
0
        public void update()
        {
            ITransaction trx = Config.con.BeginTransaction();

            Dictionary <string, object> fields = new Dictionary <string, object>();

            fields.Add("customer_name", "alteredByUpdate");

            trx.Update(
                typeof(DM_Customer),
                fields,
                new CriterionEqual("customer_id", 1));

            trx.Commit();

            trx = Config.con.BeginTransaction();

            DM_Customer cust = (DM_Customer)trx.Load(typeof(DM_Customer), 1);

            Assert.AreEqual(cust.customer_name, "alteredByUpdate");

            cust.customer_name = "Glaser Corp.";

            trx.Save();

            trx.Commit();
        }
Beispiel #2
0
        public void loadTest()
        {
            ITransaction trx = Config.con.BeginTransaction();

            DM_Customer cust = (DM_Customer)trx.Load(
                typeof(DM_Customer),
                1);

            trx.Commit();

            Assert.AreEqual(cust.date_last_modified, new DateTime(2007, 8, 9, 10, 11, 12));
        }
Beispiel #3
0
        public void deleteByEntity()
        {
            ITransaction trx = Config.con.BeginTransaction();

            DM_Customer cust = (DM_Customer)trx.Load(
                typeof(DM_Customer),
                100);

            trx.Delete(cust);

            trx.Commit();

            isGone();
        }
Beispiel #4
0
        public void setup()
        {
            ITransaction trx = Config.con.BeginTransaction();

            DM_Customer cust = (DM_Customer)trx.Load(
                typeof(DM_Customer),
                1);

            cust.customer_name = "Glaser Corp.";

            trx.Save();

            trx.Delete(typeof(DM_Order), new CriterionEqual("order_id", 200));

            trx.Commit();
        }
Beispiel #5
0
        public void checkUpdateMerge()
        {
            ITransaction trxA = Config.con.BeginTransaction();
            ITransaction trxB = Config.con.BeginTransaction();

            DM_Customer cA = (DM_Customer)trxA.Load(
                typeof(DM_Customer),
                1);

            DM_Customer cB = (DM_Customer)trxB.Load(
                typeof(DM_Customer),
                1);

            cA.customer_name = "Changed by A";

            trxA.Save(cA);

            trxA.Commit();

            cB.customer_no = 4321;

            trxB.Save(cB);

            trxB.Commit();

            trxA = Config.con.BeginTransaction();

            cA = (DM_Customer)trxA.Load(
                typeof(DM_Customer),
                1);

            cA.customer_name = "Glaser Corp.";
            cA.customer_no   = 4711;

            trxA.Save();
            trxA.Commit();
        }
Beispiel #6
0
        public void checkUpdateConflict()
        {
            ITransaction trxA = Config.con.BeginTransaction();
            ITransaction trxB = Config.con.BeginTransaction();

            DM_Customer cA = (DM_Customer)trxA.Load(
                typeof(DM_Customer),
                1);

            DM_Customer cB = (DM_Customer)trxB.Load(
                typeof(DM_Customer),
                1);

            cA.customer_name = "Changed by A";

            trxA.Save(cA);

            trxA.Commit();

            cB.customer_name = "Changed by B";

            Exception ex = null;

            try
            {
                trxB.Save();
            }
            catch (Exception e)
            {
                ex = e;
            }

            Assert.IsNotNull(ex);
            Assert.AreEqual(typeof(DBConcurrencyException).ToString(), ex.GetType().ToString());

            setup();
        }