eloquera Object’s Unique ID Mapping AND Disconnected Scenario

279 views Asked by At

hi excuse for my english iam a french speaker
I am working on a asp.net mvc project using eloquera as the database.
I have encounter problem with the object uid auto mapping.
the uid generated by the database is not mapped to the corresponding object field.
please can someone tell me what is wrong with my code

class Program {

    static void Main(string[] args)
    {
        var dbname = "testElo";
        DB db = new DB("server=localhost;password=pwd;options=none;");
        db.DeleteDatabase(dbname, true);
        db.CreateDatabase(dbname);
        db.OpenDatabase(dbname);
        var p = new Person()
                    {
                        Nom = "giscard"
                    };
        var uid = db.Store(p);
        db.Close();
        db.OpenDatabase(dbname);
        db.RefreshMode = ObjectRefreshMode.AlwaysReturnUpdatedValues;
        var tmp = (from Person per in db select per).ToList().SingleOrDefault();
        Console.WriteLine("expected uid {0}", uid);
        Console.WriteLine("object uid using PersonId field {0}", tmp.PersonId);
        Console.WriteLine("object uid using db.GetUid {0}", db.GetUid(tmp));

        Console.WriteLine("press enter to finish");
        Console.ReadLine();
    }

    class Person
    {
        [ID]
        public int PersonId;
        public string Nom;
    }

here is the ouput

expected uid 282574488338433
object uid using PersonId field 0
object uid using db.GetUid 282574488338433
press enter to finish

0

There are 0 answers