예제 #1
0
        private static void StructuredContains(IObjectContainer container)
        {
            // #example: Structured contains
            BlogPost pilotExample = new BlogPost();
            pilotExample.AddAuthors(new Author("John"));
            IList result = container.QueryByExample(pilotExample);
            // #end example

            ListResult(result);
        }
예제 #2
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);
        }
예제 #3
0
        private static void ContainsQuery(IObjectContainer container)
        {
            // #example: Contains in collections
            BlogPost pilotExample = new BlogPost();
            pilotExample.AddTags("db4o");
            IList result = container.QueryByExample(pilotExample);
            // #end example

            ListResult(result);
        }