I think I misunderstood the purpose of the InitClassEmpty method. There is a nice user code region, so i thought i could use it to set initial values for the fields of the entity, like this:
// __LLBLGENPRO_USER_CODE_REGION_START InitClassEmpty
if (Fields.State == EntityState.New)
{
percentage = 100;
amount = 0;
}
// __LLBLGENPRO_USER_CODE_REGION_END
However, when i fetch a collection of entities from the DB the values from the DB are overwritten by my settings in the user code region. It was supposed to do that only for new entities.
Why does this happen and what is the better way of supplying initial values?