LLBLGEN Pro 2.6 Final
SelfServicing, TwoClasses
Hello everyone,
how can I initialize new Entities with default values?
I tried this
protected override void OnInitialized()
{
base.OnInitialized();
if (this.IsNew)
{
InitNewEntity(); // set default values; this.fielda = "aaa".....
}
}
But this event "OnInitialized()" will be called also for existing Entities, before there will be fetched.
Is there an Event which will only be called, if the Entity is realy new?
I could use this code in my Form:
MyEntity ent = new MyEntity();
if (ent.IsNew())
{
InitNewEntity();
}
This would work. But I want to use this logic inside my entity.
Can anyone give me an hint?
Thanks,
Alex