OrientDB-NET.binary icon indicating copy to clipboard operation
OrientDB-NET.binary copied to clipboard

"Object" members lose their value when saved

Open cha67 opened this issue 10 years ago • 0 comments

Hello !

This small test is failing because when saving, Object members values are lost (not stored in Db)

I don't understand why in the driver code. This is possible with CouchDb (Hammock driver) and MongoDb. Hammock serializes directly C# objects to JSON for storage (with JSON.Net)

    [Test]
    public void InsertWithObjectMember()
    {
        Utils.InitPool();

        using (ODatabase database = new ODatabase("alias"))
        {
            EntityOrientDbDTO entity = new EntityOrientDbDTO();
            entity.Data = "'e=mc2'"; //Data member type is Oject

            ODocument d = database.Insert<EntityOrientDbDTO>(entity).Run();

            List<EntityOrientDbDTO> result = database
            .Select()
            .From(typeof(EntityOrientDbDTO).Name)
            .Where("@rid").Equals(d.ORID) 
            .ToList<EntityOrientDbDTO>();

            Assert.AreEqual("'e=mc2'", result.First().Data); //result.First().Data.GetType()    {Name = "Object" FullName = "System.Object"}    System.Type {System.RuntimeType}

        }
    }

cha67 avatar May 14 '15 11:05 cha67