コード例 #1
0
        public void CointainInvalidValues()
        {
            DynaEntity de = InitializeNewDyna();

            de.DynaBean["Person"] = new Person("A");
            try
            {
                using (ISession s = OpenSession())
                    using (ITransaction tx = s.BeginTransaction())
                    {
                        s.Update(de);
                        tx.Commit();
                    }
                Assert.Fail("The DynaEntity should be NO valid");
            }
            catch (InvalidStateException)
            {
                // ok
            }

            CleanUp();
        }
コード例 #2
0
        private DynaEntity InitializeNewDyna()
        {
            DynaEntity de = new DynaEntity();

            de.DynaBean            = new Hashtable();
            de.DynaBean["TheName"] = "Arturius";
            de.DynaBean["Person"]  = null;
            object savedId;

            using (ISession s = OpenSession())
                using (ITransaction tx = s.BeginTransaction())
                {
                    savedId = s.Save(de);
                    tx.Commit();
                }
            DynaEntity result;

            using (ISession s = OpenSession())
            {
                result = s.Get <DynaEntity>(savedId);
            }
            return(result);
        }
コード例 #3
0
 private DynaEntity InitializeNewDyna()
 {
     DynaEntity de = new DynaEntity();
     de.DynaBean = new Hashtable();
     de.DynaBean["TheName"] = "Arturius";
     de.DynaBean["Person"] = null;
     object savedId;
     using (ISession s = OpenSession())
     using (ITransaction tx = s.BeginTransaction())
     {
         savedId = s.Save(de);
         tx.Commit();
     }
     DynaEntity result;
     using (ISession s = OpenSession())
     {
         result = s.Get<DynaEntity>(savedId);
     }
     return result;
 }