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(); }
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); }
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; }