예제 #1
0
        public void TestJoinQuery()
        {
            Person p = new Person();

            p.FirstName = "Mirko";
            p.LastName  = "Matytschak";
            p.Moniker   = "Hallo";
            Adresse a1 = new Adresse();

            a1.Lkz    = "D";
            a1.Plz    = "83646";
            a1.Straße = "Nockhergasse 7";
            a1.Ort    = "Bad Tölz";

            Adresse a2 = new Adresse();

            a2.Ort    = "Mönchen";
            a2.Plz    = "80331";
            a2.Straße = "Isartorplatz 5";
            a2.Lkz    = "D";

            Institution i = new Institution();

            i.FirstName   = "Schnulli";
            i.LastName    = "Wauwau";
            i.Hausmeister = "Möller";

            pm.MakePersistent(a1);
            pm.MakePersistent(a2);
            pm.MakePersistent(p);
            pm.MakePersistent(i);
            i.AddAdresse(a1);
            p.AddAdresse(a1);
            p.AddAdresse(a2);
            pm.Save();
            pm.UnloadCache();

            IQuery q = new NDOQuery <Contact>(pm, $"addresses.plz = '{a2.Plz}'");
            IList  l = q.Execute();

            Assert.AreEqual(1, l.Count, "Wrong number of contacts");
        }