Hello,
I am using derived adapter tempates. I need to put some field initialization code in place for new entities only. If the entity is being retrieved from the database, I don't want to overwrite the values.
I have reviewed the "Generated code - Adding your own code to the generated classes" section of the documentation and tried the following:
- the __LLBLGENPRO_USER_CODE_REGION_START InitClass area in the derived class.
- the __LLBLGENPRO_USER_CODE_REGION_START InitClassEmpty area in the base entity.
- the __LLBLGENPRO_USER_CODE_REGION_START InitClassMembers area in the base entity.
In all cases, my initialization code is being executed whether I am creating a new entity like:
MyEntity var = New MyEntity();
or whether I am loading the entity from the database using a DAA.Fetch method.
I have got around it in the short term by putting my initialization code in the public void MyEntity() constructor, but it gets overwritten when I regenerate the code of course.
Where should I put my initialization coding, and how can I detect that this is a new entity created by a call to the MyEntity() constructor or an entity being created to be loaded from the database, in which case I don't want to run the default value coding?
Thanks,
Can1