This is a migrated thread and some comments may be shown as answers.

Field Not Set

1 Answer 41 Views
Data Access Free Edition
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Dennis
Top achievements
Rank 1
Dennis asked on 15 Nov 2013, 05:32 AM
Hi,

I have this class declaration.  I also added the HasFieldName("_num") on the Number property.  When I read the contents from the database, the value of _num is always zero, even if Number property is not zero.  Why is it not synchornized?

class Test
{
  public Number {
    get { return _num; }
    set { _num = value; }
  }
 
  private int _num = 0;
}

1 Answer, 1 is accepted

Sort by
0
Boris Georgiev
Telerik team
answered on 19 Nov 2013, 05:18 PM
Hi Dennis,

The field values are populated lazily when one of the properties is accessed. Telerik OpenAccess ORM has this behavior for performance optimization. If you want to populate the fields with the actual values you should invoke the OpenAccessEnhancedPreSerialize method on every entity loaded in the memory:
((PersistenceCapable)entity).OpenAccessEnhancedPreSerialize();
To cast the object to PersistenceCapable you should use: Telerik.OpenAccess.SPI.dataobjects namespace.

If any other questions arise, do not hesitate to contact us again.

Regards,
Boris Georgiev
Telerik
OpenAccess ORM Q3 2013 simplifies your model operations even further providing you with greater flexibility. Check out the list of new features shipped with our latest release!
Tags
Data Access Free Edition
Asked by
Dennis
Top achievements
Rank 1
Answers by
Boris Georgiev
Telerik team
Share this question
or