Пример #1
0
        private static void QueryForAge(IObjectContainer container)
        {
            // #example: Query for 33 year old pilots
            Pilot theExample = new Pilot();
            theExample.Age = 33;
            IList result = container.QueryByExample(theExample);
            // #end example

            ListResult(result);
        }
Пример #2
0
        private static void QueryForName(IObjectContainer container)
        {
            // #example: Query for John by example
            Pilot theExample = new Pilot();
            theExample.Name = "John";
            IList result = container.QueryByExample(theExample);
            // #end example

            ListResult(result);
        }
Пример #3
0
        private static void QueryForNameAndAge(IObjectContainer container)
        {
            // #example: Query a 29 years old Jo
            Pilot theExample = new Pilot();
            theExample.Name = "Jo";
            theExample.Age = 29;
            IList result = container.QueryByExample(theExample);
            // #end example

            ListResult(result);
        }
Пример #4
0
        private static void NestedObjects(IObjectContainer container)
        {
            // #example: Nested objects example
            Pilot pilotExample = new Pilot();

            pilotExample.Name = "Jenny";

            Car carExample = new Car();

            carExample.Pilot = pilotExample;
            IList result = container.QueryByExample(carExample);

            // #end example

            ListResult(result);
        }
Пример #5
0
        private static void StoreData(IObjectContainer container)
        {
            Pilot john     = new Pilot("John", 42);
            Pilot joanna   = new Pilot("Joanna", 45);
            Pilot jenny    = new Pilot("Jenny", 21);
            Pilot rick     = new Pilot("Rick", 33);
            Pilot juliette = new Pilot("Juliette", 33);

            container.Store(new Pilot("Jo", 34));
            container.Store(new Pilot("Jo", 29));
            container.Store(new Pilot("Jimmy", 33));


            container.Store(new Car(john, "Ferrari"));
            container.Store(new Car(joanna, "Mercedes"));
            container.Store(new Car(jenny, "Volvo"));
            container.Store(new Car(rick, "Fiat"));
            container.Store(new Car(juliette, "Suzuki"));


            BlogPost firstPost = new BlogPost("db4o", "Content about db4o");

            firstPost.AddTags("db4o", ".net", "java", "database");
            firstPost.AddMetaData("comment-feed-link", "localhost/rss");
            firstPost.AddAuthors(new Author("John"), new Author("Jenny"), new Author("Joanna"));

            container.Store(firstPost);

            BlogPost secondPost = new BlogPost("cars", "Speedy cars");

            secondPost.AddTags("cars", "fast");
            secondPost.AddMetaData("comment-feed-link", "localhost/rss");
            secondPost.AddMetaData("source", "www.wikipedia.org");
            secondPost.AddAuthors(new Author("Joanna"), new Author("Jenny"));

            container.Store(secondPost);
        }
Пример #6
0
 public Car(Pilot pilot, string name)
 {
     this.pilot = pilot;
     this.name  = name;
 }
Пример #7
0
        private static void NestedObjects(IObjectContainer container)
        {
            // #example: Nested objects example
            Pilot pilotExample = new Pilot();
            pilotExample.Name = "Jenny";

            Car carExample = new Car();
            carExample.Pilot = pilotExample;
            IList result = container.QueryByExample(carExample);
            // #end example

            ListResult(result);
        }
Пример #8
0
        private static void AllObjectsOfATypeWithEmptyObject(IObjectContainer container)
        {
            // #example: All objects of a type by passing a empty example
            Pilot example = new Pilot();
            IList result = container.QueryByExample(example);
            // #end example

            ListResult(result);
        }
Пример #9
0
        private static void StoreData(IObjectContainer container)
        {
            Pilot john = new Pilot("John", 42);
            Pilot joanna = new Pilot("Joanna", 45);
            Pilot jenny = new Pilot("Jenny", 21);
            Pilot rick = new Pilot("Rick", 33);
            Pilot juliette = new Pilot("Juliette", 33);
            container.Store(new Pilot("Jo", 34));
            container.Store(new Pilot("Jo", 29));
            container.Store(new Pilot("Jimmy", 33));


            container.Store(new Car(john, "Ferrari"));
            container.Store(new Car(joanna, "Mercedes"));
            container.Store(new Car(jenny, "Volvo"));
            container.Store(new Car(rick, "Fiat"));
            container.Store(new Car(juliette, "Suzuki"));


            BlogPost firstPost = new BlogPost("db4o", "Content about db4o");
            firstPost.AddTags("db4o", ".net", "java", "database");
            firstPost.AddMetaData("comment-feed-link", "localhost/rss");
            firstPost.AddAuthors(new Author("John"), new Author("Jenny"), new Author("Joanna"));

            container.Store(firstPost);

            BlogPost secondPost = new BlogPost("cars", "Speedy cars");
            secondPost.AddTags("cars", "fast");
            secondPost.AddMetaData("comment-feed-link", "localhost/rss");
            secondPost.AddMetaData("source", "www.wikipedia.org");
            secondPost.AddAuthors(new Author("Joanna"), new Author("Jenny"));

            container.Store(secondPost);
        }
Пример #10
0
 public Car(Pilot pilot, string name)
 {
     this.pilot = pilot;
     this.name = name;
 }