Beispiel #1
0
        public void AggrTestCreateObjectsWithTransaction()
        {
            var pm = PmFactory.NewPersistenceManager();
            var tm = pm.TransactionMode;

            try
            {
                // See Issue #1145
                // The test would fail, if we didn't alter the update rank
                // according to the actual situation, that e has a valid database id.
                // The test would fail, because the update rank would cause e to be saved first
                // at the 2nd Save() call.
                pm.TransactionMode = TransactionMode.Optimistic;
                pm.MakePersistent(e);
                pm.Save(true);
                pm.MakePersistent(z0);
                e.Schlüssel = z0;
                pm.Save();
                pm.UnloadCache();
                pm.TransactionMode = TransactionMode.None;
                var email = pm.Objects <Email>().Single();
                Assert.NotNull(email.Schlüssel);
                Assert.AreEqual(42, email.Schlüssel.Key);
                pm.UnloadCache();
                var zertifikat = pm.Objects <Zertifikat>().Single();
                Assert.NotNull(zertifikat.Adresse);
            }
            finally
            {
                pm.TransactionMode = tm;
            }
        }
Beispiel #2
0
        public void CompTestExtentRelatedObjects()
        {
            var pm = PmFactory.NewPersistenceManager();

            m.SVN = svn;
            pm.MakePersistent(m);
            pm.Save();
            IList liste = pm.GetClassExtent(typeof(Mitarbeiter));

            m = (Mitarbeiter)liste[0];
            Assert.AreEqual(NDOObjectState.Persistent, m.NDOObjectState, "1: Mitarbeiter should be persistent");
            Assert.NotNull(m.SVN, "2. Relation is missing");
            Assert.AreEqual(NDOObjectState.Persistent, m.SVN.NDOObjectState, "2.: SVN should be hollow");
            Assert.AreSame(m, svn.Angestellter, "2. Backlink wrong");

            pm.UnloadCache();
            liste = pm.GetClassExtent(typeof(Mitarbeiter));
            m     = (Mitarbeiter)liste[0];
            Assert.AreEqual(NDOObjectState.Hollow, m.NDOObjectState, "5: Mitarbeiter should be hollow");
            Assert.NotNull(m.SVN, "6. Relation is missing");
            Assert.AreEqual(NDOObjectState.Hollow, m.SVN.NDOObjectState, "8.: SVN should be hollow");
            Assert.That(m != svn.Angestellter, "8a. Should be different objects");
            Assert.AreSame(m, m.SVN.Angestellter, "8b. Mitarbeiter should match");

            pm.UnloadCache();
            liste = pm.GetClassExtent(typeof(Mitarbeiter), false);
            m     = (Mitarbeiter)liste[0];
            Assert.AreEqual(NDOObjectState.Persistent, m.NDOObjectState, "9: Mitarbeiter should be persistent");
            Assert.NotNull(m.SVN, "10. Relation is missing");
            Assert.AreEqual(NDOObjectState.Hollow, m.SVN.NDOObjectState, "12.: SVN should be hollow");
            Assert.That(m != svn.Angestellter, "12a. Should be different objects");
            Assert.AreSame(m, m.SVN.Angestellter, "12b. Mitarbeiter should match");
        }
Beispiel #3
0
        public void AggrTestCreateObjectsSave()
        {
            var pm = PmFactory.NewPersistenceManager();

            pm.MakePersistent(z0);
            e.Schlüssel = z0;
            pm.MakePersistent(e);
            pm.Save();
            Assert.That(!e.NDOObjectId.Equals(e.Schlüssel.NDOObjectId), "Ids should be different");
            e  = (Email)pm.FindObject(e.NDOObjectId);
            z0 = (Zertifikat)pm.FindObject(e.Schlüssel.NDOObjectId);
            Assert.NotNull(e, "1. Email not found");
            Assert.NotNull(z0, "1. Zertifikat not found");
            ObjectId moid = e.NDOObjectId;
            ObjectId soid = z0.NDOObjectId;

            e  = null;
            z0 = null;

            pm.UnloadCache();
            e = (Email)pm.FindObject(moid);
            var z1 = pm.Objects <Zertifikat>().Where(z => z.Oid() == soid.Id.Value).SingleOrDefault();

            Assert.NotNull(z1);
            Zertifikat z2 = e.Schlüssel;

            Assert.AreSame(z1, z2);
            z0 = (Zertifikat)pm.FindObject(soid);
            Assert.NotNull(e, "2. Email not found");
            Assert.NotNull(z0, "2. Zertifikat not found");
            Assert.AreSame(z0, z2, "Zertifikat should match");
            Assert.AreSame(e, z0.Adresse, "Email should match");
        }
Beispiel #4
0
        private void SetupEmail()
        {
            var pm = PmFactory.NewPersistenceManager();

            pm.MakePersistent(e);
            pm.Save();
        }
Beispiel #5
0
        public void CompTestHollow()
        {
            var pm = PmFactory.NewPersistenceManager();

            m.SVN = svn;
            pm.MakePersistent(m);
            pm.Save();
            pm.MakeHollow(m);               // setzt m.svn auf null

            Assert.AreEqual(NDOObjectState.Hollow, m.NDOObjectState, "1: Mitarbeiter should be hollow");
            Assert.AreEqual(NDOObjectState.Persistent, svn.NDOObjectState, "1: SVN should be persistent");

            svn = m.SVN;             // ruft LoadData för m auf. m.svm liegt auf dem Cache und ist Persistent
            Assert.AreEqual(NDOObjectState.Persistent, m.NDOObjectState, "1: Mitarbeiter should be persistent");
            Assert.AreEqual(NDOObjectState.Persistent, svn.NDOObjectState, "2: SVN should be persistent");
            ObjectId id = m.NDOObjectId;

            pm.Close();
            pm = PmFactory.NewPersistenceManager();
            m  = (Mitarbeiter)pm.FindObject(id);
            Assert.NotNull(m, "Mitarbeiter not found");
            Assert.AreEqual(NDOObjectState.Hollow, m.NDOObjectState, "2: Mitarbeiter should be hollow");
            svn = m.SVN;
            Assert.AreEqual(NDOObjectState.Persistent, m.NDOObjectState, "2: Mitarbeiter should be persistent");
            Assert.NotNull(svn, "SVN not found");
            Assert.AreEqual(NDOObjectState.Hollow, svn.NDOObjectState, "1: SVN should be hollow");
            Assert.AreSame(m, svn.Angestellter, "2. Backlink wrong");
        }
Beispiel #6
0
        public void AggrTestHollow()
        {
            var pm = PmFactory.NewPersistenceManager();

            pm.MakePersistent(z0);
            e.Schlüssel = z0;
            pm.MakePersistent(e);
            pm.Save();
            pm.MakeHollow(e);               // setzt e.z auf null

            Assert.AreEqual(NDOObjectState.Hollow, e.NDOObjectState, "1: Email should be hollow");
            Assert.AreEqual(NDOObjectState.Persistent, z0.NDOObjectState, "1: Zertifikat should be persistent");

            z0 = e.Schlüssel;             // ruft LoadData för e auf. e.svm liegt auf dem Cache und ist Persistent
            Assert.AreEqual(NDOObjectState.Persistent, e.NDOObjectState, "1: Email should be persistent");
            Assert.AreEqual(NDOObjectState.Persistent, z0.NDOObjectState, "2: Zertifikat should be persistent");
            ObjectId id = e.NDOObjectId;

            pm.Close();
            pm = PmFactory.NewPersistenceManager();
            e  = (Email)pm.FindObject(id);
            Assert.NotNull(e, "Email not found");
            Assert.AreEqual(NDOObjectState.Hollow, e.NDOObjectState, "2: Email should be hollow");
            z0 = e.Schlüssel;
            Assert.AreEqual(NDOObjectState.Persistent, e.NDOObjectState, "2: Email should be persistent");
            Assert.NotNull(z0, "Zertifikat not found");
            Assert.AreEqual(NDOObjectState.Hollow, z0.NDOObjectState, "1: Zertifikat should be hollow");
            Assert.AreSame(e, z0.Adresse, "2. Backlink wrong");
        }
Beispiel #7
0
        public void AggrTestExtentRelatedObjects()
        {
            var pm = PmFactory.NewPersistenceManager();

            pm.MakePersistent(z0);
            e.Schlüssel = z0;
            pm.MakePersistent(e);
            pm.Save();
            IList liste = pm.GetClassExtent(typeof(Email));

            e = (Email)liste[0];
            Assert.AreEqual(NDOObjectState.Persistent, e.NDOObjectState, "1: Email should be persistent");
            Assert.NotNull(e.Schlüssel, "2. Relation is missing");
            Assert.AreEqual(NDOObjectState.Persistent, e.Schlüssel.NDOObjectState, "2.: Zertifikat should be hollow");
            Assert.AreSame(e, z0.Adresse, "2. Backlink wrong");

            pm.UnloadCache();
            liste = pm.GetClassExtent(typeof(Email));
            e     = (Email)liste[0];
            Assert.AreEqual(NDOObjectState.Hollow, e.NDOObjectState, "5: Email should be hollow");
            Assert.NotNull(e.Schlüssel, "6. Relation is missing");
            Assert.AreEqual(NDOObjectState.Hollow, e.Schlüssel.NDOObjectState, "8.: Zertifikat should be hollow");
            Assert.That(e != z0.Adresse, "8a. Should be different objects");
            Assert.AreSame(e, e.Schlüssel.Adresse, "8b. Email should match");

            pm.UnloadCache();
            liste = pm.GetClassExtent(typeof(Email), false);
            e     = (Email)liste[0];
            Assert.AreEqual(NDOObjectState.Persistent, e.NDOObjectState, "9: Email should be persistent");
            Assert.NotNull(e.Schlüssel, "10. Relation is missing");
            Assert.AreEqual(NDOObjectState.Hollow, e.Schlüssel.NDOObjectState, "12.: Zertifikat should be hollow");
            Assert.That(e != z0.Adresse, "12a. Should be different objects");
            Assert.AreSame(e, e.Schlüssel.Adresse, "12b. Email should match");
        }
Beispiel #8
0
        public void CompTestCreateObjectsSave()
        {
            var pm = PmFactory.NewPersistenceManager();

            m.SVN = svn;
            pm.MakePersistent(m);
            pm.Save();
            Assert.That(!m.NDOObjectId.Equals(m.SVN.NDOObjectId), "Ids should be different");
            m   = (Mitarbeiter)pm.FindObject(m.NDOObjectId);
            svn = (Sozialversicherungsnummer)pm.FindObject(m.SVN.NDOObjectId);
            Assert.NotNull(m, "1. Mitarbeiter not found");
            Assert.NotNull(svn, "1. SVN not found");
            ObjectId moid = m.NDOObjectId;
            ObjectId soid = svn.NDOObjectId;

            m   = null;
            svn = null;

            pm.UnloadCache();
            m = (Mitarbeiter)pm.FindObject(moid);
            Sozialversicherungsnummer s2 = m.SVN;

            svn = (Sozialversicherungsnummer)pm.FindObject(soid);
            Assert.NotNull(m, "2. Mitarbeiter not found");
            Assert.NotNull(svn, "2. SVN not found");
            Assert.AreSame(svn, s2, "SVN should match");
            Assert.AreSame(m, svn.Angestellter, "Mitarbeiter should match");
        }
Beispiel #9
0
        public void TestDfr()
        {
            var pm = PmFactory.NewPersistenceManager();

            DfrContact contact = new DfrContact();

            contact.Name = "Hans Möller";
            pm.MakePersistent(contact as IPersistenceCapable);

            DfrAddress address = new DfrAddress();

            pm.MakePersistent(address as IPersistenceCapable);
            address.Ort           = "Wahnweil";
            address.OriginContact = contact;

            DfrAddressDescriptor descriptor = address.NewAddressDescriptor(contact);

            descriptor.IsAdopted = true;

            Assert.AreEqual(1, contact.Addresses.Count, "Count falsch");
            Assert.That((contact.Addresses[0] as DfrAddressDescriptor) == descriptor, "Descriptor falsch");
            pm.Save();

            pm.MakeHollow(contact as IPersistenceCapable);

            address.RemoveAddressDescriptor(descriptor);
            Assert.AreEqual(NDOObjectState.Deleted, descriptor.NDOObjectState, "Status falsch");
        }
Beispiel #10
0
        public void ListConnection()
        {
            PersistenceManager pm   = PmFactory.NewPersistenceManager();
            Connection         conn = (Connection)pm.NDOMapping.Connections[0];

            Console.WriteLine(String.Format("\r\nConnection '{0}', Type {1}\r\n", conn.Name, conn.Type));
        }
Beispiel #11
0
        public void AggrSimpleObjectSave()
        {
            var pm = PmFactory.NewPersistenceManager();

            pm.MakePersistent(z0);
            pm.Save();
        }
Beispiel #12
0
        public void FactoryTest()
        {
            PersistenceManager pm = PmFactory.NewPersistenceManager();

            PersistenceManagerFactory.MappingFileName = pm.NDOMapping.FileName;
            PersistenceManager pm2 = PersistenceManagerFactory.NewPersistenceManager();
        }
Beispiel #13
0
        public void ChangeSetDetectsObjectAddition1_to_1()
        {
            var pm = PmFactory.NewPersistenceManager();

            m = pm.Objects <Mitarbeiter>().Single();
            Adresse a = new Adresse()
            {
                Ort = "München", Straße = "Teststr", Plz = "80133"
            };

            m.Adresse = a;
            var changeObject = pm.GetChangeSet(m);
            var original     = changeObject.original;
            var current      = changeObject.current;

            Assert.AreEqual(1, original.Count);
            Assert.AreEqual(1, current.Count);
            Assert.That(original.ContainsKey("adresse"));
            Assert.That(current.ContainsKey("adresse"));
            Assert.AreEqual(a.NDOObjectId, ((List <ObjectId>)current["adresse"])[0]);
            // At this point it doesn't make any sense to serialize the changeObject,
            // since the id of a is not yet determined.
            Assert.That((int)a.NDOObjectId.Id[0] < 0);
            pm.Save();
            var newChangeObject = changeObject.SerializableClone();

            // Now the id of r is determined. Let's assert, that the list in current reflects the change.
            Assert.That((int)a.NDOObjectId.Id[0] > 0);
            Assert.AreEqual(a.NDOObjectId.ToShortId(), ((List <string>)newChangeObject.current["adresse"])[0]);
        }
Beispiel #14
0
        public void FindObject_provides_DIParameter()
        {
            var pm         = PmFactory.NewPersistenceManager();
            var testObject = (ClassWithDIConstructor)pm.FindObject(typeof(ClassWithDIConstructor), 0);

            Assert.AreEqual("Teststring", testObject.DiField);
        }
Beispiel #15
0
        public void TearDown()
        {
            var pm = PmFactory.NewPersistenceManager();
            NDOQuery <Mitarbeiter> q = new NDOQuery <Mitarbeiter>(pm);

            pm.Delete(q.Execute());
        }
Beispiel #16
0
 public void Setup()
 {
     pm = PmFactory.NewPersistenceManager();
     m  = CreateMitarbeiter("Mirko", "Matytschak");
     a  = CreateAdresse("D", "83646", "Nockhergasse 7", "Bad Tölz");
     b  = CreateBuero("3-0815");
 }
Beispiel #17
0
        public void AssoTestHollow()
        {
            pm.MakePersistent(b);
            m.Zimmer = b;
            pm.MakePersistent(m);
            pm.Save();
            pm.MakeHollow(m);               // setzt m.Zimmer auf null

            Assert.AreEqual(NDOObjectState.Hollow, m.NDOObjectState, "1: Mitarbeiter should be hollow");
            Assert.AreEqual(NDOObjectState.Persistent, b.NDOObjectState, "1: Büro should be persistent");

            b = m.Zimmer;             // ruft LoadData för m auf. m.Zimmer liegt im Cache und ist Persistent
            Assert.AreEqual(NDOObjectState.Persistent, m.NDOObjectState, "1: Mitarbeiter should be persistent");
            Assert.AreEqual(NDOObjectState.Persistent, b.NDOObjectState, "2: Adresse should be persistent");
            ObjectId id = m.NDOObjectId;

            pm.Close();
            pm = PmFactory.NewPersistenceManager();
            m  = (Mitarbeiter)pm.FindObject(id);
            Assert.NotNull(m, "Mitarbeiter not found");
            Assert.AreEqual(NDOObjectState.Hollow, m.NDOObjectState, "2: Mitarbeiter should be hollow");
            b = m.Zimmer;
            Assert.AreEqual(NDOObjectState.Persistent, m.NDOObjectState, "2: Mitarbeiter should be persistent");
            Assert.NotNull(b, "Büro not found");
            Assert.AreEqual(NDOObjectState.Hollow, b.NDOObjectState, "1: Büro should be hollow");
        }
Beispiel #18
0
		private static void Requery()
		{
#if persistentIds
#if ORACLE
			string seq = /* "\"" + schemaName + "\".*/  \"" + sequenceName + "\"";
			string sql = "select " + seq + ".Nextval from dual";
			OracleConnection conn = new OracleConnection(connectionString);
			OracleCommand cmd = new OracleCommand(sql, conn);
			conn.Open();
			OracleDataReader reader = cmd.ExecuteReader();
			if (!reader.Read())
				throw new Exception("Can't read oracle sequence " + seq);
			currentId = reader.GetInt32(0);			
			conn.Close();
			upperLimit = currentId + increment;
#endif
#if FIREBIRD
			//SET GENERATOR "NDOGenerator" TO 0;
			PersistenceManager pm = PmFactory.NewPersistenceManager();
			IQuery q = new NDOQuery<SequenceValue), "SELECT GEN_ID(\"NDOGenerator\", " + increment.ToString() + ") AS \"Value\" FROM RDB$DATABASE;", false, QueryLanguage.Sql); 
			SequenceValue sv = (SequenceValue) q.ExecuteSingle();
			currentId = sv.Value;
			upperLimit = sv.Value + increment;
#endif
#else
            currentId = 1;
            upperLimit = 0x7fffffff;
#endif
		}
Beispiel #19
0
        public void AggrTestReplaceChildSave()
        {
            var pm = PmFactory.NewPersistenceManager();

            pm.MakePersistent(z0);
            pm.MakePersistent(e);
            e.Schlüssel = z0;
            pm.Save();
            Assert.NotNull(e.Schlüssel, "1. Zertifikat not found");
            Zertifikat z2 = new Zertifikat();

            z2.Key = 0815;
            pm.MakePersistent(z2);
            e.Schlüssel = z2;
            Assert.AreEqual(NDOObjectState.PersistentDirty, z0.NDOObjectState, "1. Wrong state");
            Assert.AreEqual(NDOObjectState.Created, z2.NDOObjectState, "2. Wrong state");
            Assert.Null(z0.Adresse, "3. No relation to Email");
            Assert.AreSame(z2.Adresse, e, "4. Email should be same");
            Assert.AreSame(e.Schlüssel, z2, "5. Zertifikat should be same");
            pm.Save();
            Assert.AreEqual(NDOObjectState.Persistent, z0.NDOObjectState, "6. Wrong state");
            Assert.AreEqual(NDOObjectState.Persistent, z2.NDOObjectState, "7. Wrong state");
            Assert.Null(z0.Adresse, "8. No relation to Email");
            Assert.AreSame(z2.Adresse, e, "9. Email should be same");
            Assert.AreSame(e.Schlüssel, z2, "10. Zertifikat should be same");
        }
Beispiel #20
0
 public void Setup()
 {
     pm      = PmFactory.NewPersistenceManager();
     z       = CreateZertifikat(0815);
     sgn     = new Signatur();
     sgn.Key = "Signiert";
 }
Beispiel #21
0
        public void TestRefresh()
        {
            m.Hinzufuegen(r);
            pm.MakePersistent(m);
            pm.Save();
            pm.MakeHollow(r);
            pm.Refresh(r);
            Assert.AreEqual(NDOObjectState.Persistent, r.NDOObjectState, "Wrong state #1");
            pm.Refresh(r);
            Assert.AreEqual(NDOObjectState.Persistent, r.NDOObjectState, "Wrong state #2");
            ObjectId id = r.NDOObjectId;

            PersistenceManager pm2 = PmFactory.NewPersistenceManager();
            Reise m2 = (Reise)pm2.FindObject(id);

            Assert.NotNull(m2, "Cannot load object");
            m2.Zweck = "Test";
            pm2.Save();
            pm2.Close();

            Assert.AreEqual("ADC", r.Zweck, "Wrong name #1");
            Assert.AreEqual("Test", m2.Zweck, "Wrong name #2");
            pm.Refresh(r);
            Assert.AreEqual("Test", r.Zweck, "Wrong name #3");
        }
Beispiel #22
0
        public void CompTestHollow()
        {
            z.SGN = sgn;
            pm.MakePersistent(z);
            pm.Save();
            pm.MakeHollow(z);               // setzt z.sgn auf null

            Assert.AreEqual(NDOObjectState.Hollow, z.NDOObjectState, "1: Zertifikat should be hollow");
            Assert.AreEqual(NDOObjectState.Persistent, sgn.NDOObjectState, "1: SGN should be persistent");

            sgn = z.SGN;             // ruft LoadData för z auf. z.svm liegt auf dem Cache und ist Persistent
            Assert.AreEqual(NDOObjectState.Persistent, z.NDOObjectState, "1: Zertifikat should be persistent");
            Assert.AreEqual(NDOObjectState.Persistent, sgn.NDOObjectState, "2: SGN should be persistent");
            ObjectId id = z.NDOObjectId;

            pm.Close();
            pm = PmFactory.NewPersistenceManager();
            z  = (Zertifikat)pm.FindObject(id);
            Assert.NotNull(z, "Zertifikat not found");
            Assert.AreEqual(NDOObjectState.Hollow, z.NDOObjectState, "2: Zertifikat should be hollow");
            sgn = z.SGN;
            Assert.AreEqual(NDOObjectState.Persistent, z.NDOObjectState, "2: Zertifikat should be persistent");
            Assert.NotNull(sgn, "SGN not found");
            Assert.AreEqual(NDOObjectState.Hollow, sgn.NDOObjectState, "1: SGN should be hollow");
            Assert.AreSame(z, sgn.Owner, "2. Backlink wrong");
        }
Beispiel #23
0
        public void AggrTestRemoveParentSave()
        {
            var pm = PmFactory.NewPersistenceManager();

            pm.MakePersistent(z0);
            pm.MakePersistent(e);
            e.Schlüssel = z0;
            pm.Save();
            Assert.NotNull(z0.Adresse, "1. Email not found");
            ObjectId aoid = z0.NDOObjectId;

            z0.Adresse = null;
            Assert.AreEqual(NDOObjectState.PersistentDirty, z0.NDOObjectState, "1. Wrong state");
            Assert.Null(e.Schlüssel, "1. Zertifikat should be null");
            Assert.Null(z0.Adresse, "1. Email should be null");
            pm.Save();
            Assert.Null(e.Schlüssel, "2. Zertifikat should be null");
            Assert.AreEqual(NDOObjectState.Persistent, z0.NDOObjectState, "2. Wrong state");
            ObjectId moid = e.NDOObjectId;

            Assert.That(aoid.IsValid(), "Zertifikat still valid");
            pm.UnloadCache();
            e = (Email)pm.FindObject(moid);
            Assert.NotNull(e, "3. Email not found");
            Assert.Null(e.Schlüssel, "3. Zertifikat should be null");
        }
Beispiel #24
0
        public void ChangeSetDetectsObjectDeletion1_to_1()
        {
            var pm = PmFactory.NewPersistenceManager();

            m = pm.Objects <Mitarbeiter>().Single();
            Adresse a = new Adresse()
            {
                Ort = "München", Straße = "Teststr", Plz = "80133"
            };

            m.Adresse = a;
            pm.Save();
            pm.UnloadCache();
            m         = pm.Objects <Mitarbeiter>().Single();
            m.Adresse = null;
            var changeObject = pm.GetChangeSet(m);
            var original     = changeObject.original;
            var current      = changeObject.current;

            Assert.AreEqual(1, original.Count);
            Assert.AreEqual(1, current.Count);
            Assert.That(original.ContainsKey("adresse"));
            Assert.That(current.ContainsKey("adresse"));
            Assert.AreEqual(1, ((List <ObjectId>)original["adresse"]).Count);
            Assert.AreEqual(0, ((List <ObjectId>)current["adresse"]).Count);
        }
Beispiel #25
0
        public void TearDown()
        {
            var pm = PmFactory.NewPersistenceManager();

            pm.TransactionMode = TransactionMode.None;

            //pm.UnloadCache();
            IList reiseliste = pm.GetClassExtent(typeof(Reise), true);

            pm.Delete(reiseliste);
            pm.Save();
            pm.UnloadCache();
            IQuery q;
            IList  liste;

            // We can't delete orphan Beleg object with NDO, so use direct Sql statements
            using (var handler = pm.GetSqlPassThroughHandler())
            {
                var sql = "DELETE FROM " + pm.NDOMapping.FindClass(typeof(Beleg)).TableName;
                handler.Execute(sql);
            }

            q     = new NDOQuery <Contact>(pm);
            liste = q.Execute();
            pm.Delete(liste);
            pm.Save();
            q     = new NDOQuery <Adresse>(pm);
            liste = q.Execute();
            pm.Delete(liste);
            pm.Save();
            pm.Dispose();
        }
Beispiel #26
0
        public void CompTestHollow()
        {
            m.Adresse = a;
            pm.MakePersistent(m);
            pm.Save();
            pm.MakeHollow(m);               // setzt m.adresse auf null

            Assert.AreEqual(NDOObjectState.Hollow, m.NDOObjectState, "1: Mitarbeiter should be hollow");
            Assert.AreEqual(NDOObjectState.Persistent, a.NDOObjectState, "1: Adresse should be persistent");

            a = m.Adresse;             // ruft LoadData för m auf. m.adresse liegt auf dem Cache und ist Persistent
            Assert.AreEqual(NDOObjectState.Persistent, m.NDOObjectState, "1: Mitarbeiter should be persistent");
            Assert.AreEqual(NDOObjectState.Persistent, a.NDOObjectState, "2: Adresse should be persistent");
            ObjectId id = m.NDOObjectId;

            pm.Close();
            pm = PmFactory.NewPersistenceManager();
            m  = (Mitarbeiter)pm.FindObject(id);
            Assert.NotNull(m, "Mitarbeiter not found");
            Assert.AreEqual(NDOObjectState.Hollow, m.NDOObjectState, "2: Mitarbeiter should be hollow");
            a = m.Adresse;
            Assert.AreEqual(NDOObjectState.Persistent, m.NDOObjectState, "2: Mitarbeiter should be persistent");
            Assert.NotNull(a, "Adress not found");
            Assert.AreEqual(NDOObjectState.Hollow, a.NDOObjectState, "1: Adresse should be hollow");
        }
Beispiel #27
0
 public void Setup()
 {
     pm = PmFactory.NewPersistenceManager();
     m  = CreateMitarbeiter("Hartmut", "Kocher");
     pm.MakePersistent(m);
     r  = CreateReise("ADC");
     r2 = CreateReise("ADW");
 }
Beispiel #28
0
 public void Setup()
 {
     pm = PmFactory.NewPersistenceManager();
     r  = CreateReise("ADC");
     m  = CreateMitarbeiter();
     m.Hinzufuegen(r);
     pm.MakePersistent(m);
 }
Beispiel #29
0
        public void TearDown()
        {
            var pm = PmFactory.NewPersistenceManager();

            DeleteAll();
            pm.Close();
            pm = null;
        }
Beispiel #30
0
        public void AggrChildAddFail()
        {
            var pm = PmFactory.NewPersistenceManager();

            pm.MakePersistent(z0);
            pm.MakePersistent(e);
            z0.Adresse = e;
        }