Esercizio con db40


non sono se lo utilizzero mai, oggi ho fatto qualche piccolo test con questo open source object database engine
http://www.db4o.com/

Esempio di codice

using System;
using System.Collections.Generic;
using Db4objects.Db4o;

namespace testdb4O
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("START TEST");

            Person p = new Person("John", 35);
            Person p2 = new Person("David", 3);
            IObjectContainer db = Db4oFactory.OpenFile("db4o_test.yap");

            //Inserisco
            db.Store(p);
            db.Store(p2);

            //Elenco
            Person q = new Person(null, 0);

            IObjectSet list = db.QueryByExample(q);

            foreach (Person person in list)
            {
                Console.WriteLine(person._name + " " + person._age);
                person._age = person._age + 10;
                db.Store(person);
            }


            foreach (Person person in db.QueryByExample(q))
            {
                Console.WriteLine(person._name + " " + person._age);
                person._age = person._age + 10;
                db.Store(person);
            }

            db.Close();
            db.Dispose();
            Console.WriteLine("END TEST");
            Console.ReadLine();
        }
    }

    class Person
    {
    // private stuff
    public string _name;
    public int _age;

    // constructor
    public Person(string name, int age)
    {
    this._name = name;
    this._age = age;
    }
    }

}

posted @ lunedì 19 gennaio 2009 19:47

Print

Comments on this entry:

# re: Esercizio con db40

Left by luciano at 21/01/2009 23:18
Gravatar
interessante, magari per qualche applicazione distribuita.

# re: Esercizio con db40

Left by he at 13/11/2014 18:48
Gravatar
rapidly competitive social check credit score major economic ebbs and flows credit report score impact analytics 40

# re: Esercizio con db40

Left by http://www.sg-paysages.fr at 24/07/2015 08:41
Gravatar
IObjectSet list = db.QueryByExample(q);

# re: Esercizio con db40

Left by Jerome at 09/07/2017 19:02
Gravatar
This is good website have deserts related a lot of information. Infect, this website is all about it and some very interesting facts described in different articles of this website. Actually, I want to get Essayrepublic Review but i have some questions in my mind about desert which now clear.
Comments have been closed on this topic.
«novembre»
domlunmarmergiovensab
272829303112
3456789
10111213141516
17181920212223
24252627282930
1234567