예제 #1
0
 public override void SetUp()
 {
     base.SetUp();
     DeleteBase("cyclic.ndb");
     var odb = Open("cyclic.ndb");
     var brasil = new Country("Brasil");
     for (var i = 0; i < 10; i++)
     {
         var city = new City("city" + i);
         city.SetCountry(brasil);
         brasil.AddCity(city);
     }
     odb.Store(brasil);
     odb.Close();
 }
예제 #2
0
 public override void SetUp()
 {
     base.SetUp();
     DeleteBase("cyclic.ndb");
     var odb = Open("cyclic.ndb");
     for (var i = 0; i < 1; i++)
     {
         var brasilia = new City("Brasilia" + i);
         var brasil = new Country2("Brasil" + i);
         brasilia.SetCountry(brasil);
         brasil.SetCapital(brasilia);
         brasil.SetPopulation(450000);
         odb.Store(brasil);
     }
     odb.Store(new User("name", "email", new Profile("profile")));
     odb.Close();
 }
예제 #3
0
        public virtual void Test2()
        {
            var odb = Open("cyclic.ndb");
            var query1 = odb.Query<Country2>();
            var l = query1.Execute<Country2>(true);
            var country = l.GetFirst();
            var city = new City("rio de janeiro");
            country.SetCapital(city);
            odb.Store(country);
            odb.Close();
            odb = Open("cyclic.ndb");
            var query2 = odb.Query<Country2>();
            l = query2.Execute<Country2>(true);
            country = l.GetFirst();
            AssertEquals("rio de janeiro", country.GetCapital().GetName());
            var query = odb.Query<City>();
            query.Descend("name").Constrain((object) "rio de janeiro").Equal();
            var cities = query.Execute<City>();
            AssertEquals(1, cities.Count);

            var cities2 = odb.Query<City>().Execute<City>();
            AssertEquals(2, cities2.Count);
            odb.Close();
        }
예제 #4
0
 public virtual void AddCity(City city)
 {
     cities.Add(city);
 }