Thank you for your efforts!
I have now created a test project:
-
a new database with only 2 tables. (SQL-Server)
These tables have no relationships, no special features. Just tables with primary keys.
- created a new LLBLGEN 5.4.1 project, Database first.
- source code generated with TwoClasses SelfService.
- both entities extended with partial classes
- in this partial classes onInitialized overwritten and a console message written in.
6.. That's it.
My console program now creates an entity of Table1, but it calls the OnInitialized events of BOTH tables.
After, i create although a table2-Entitiy and here it only calls OnInitialized from Table 2.
Console program:
static void Main(string[] args)
{
Console.WriteLine("Here we go: Now i will create Table1 Entity:");
var tab1 = new Table1Entity();
Console.WriteLine("I have just created Table1 Entity");
Console.WriteLine("");
Console.WriteLine("Now i will create Table 2 Entity:");
var tab2 = new Table2Entity();
Console.WriteLine("I have just created Table2 Entity");
Console.WriteLine("Now i'm at the end - completely...");
Console.ReadKey();
}
My Partial-Class-Extensions: (the same for Table2)
public partial class Table1Entity : Table1EntityBase
{
protected override void OnInitialized()
{
base.OnInitialized();
Console.WriteLine("Here is OnInitialized from Table1");
}
}
Output:
Here we go: Now i will create Table1 Entity:
Here is OnInitialized from Table1
Here is OnInitialized from Table2
Here is OnInitialized from Table1
I have just created Table1 Entity
Now i will create Table 2 Entity:
Here is OnInitialized from Table2
I have just created Table2 Entity
Now i'm at the end - completely...
You see: OnInitialized is called for EVERY Entite, for Entity Table1 twice (don't know why).
After that it's fired only for created Entities.
That's not normal, is it?
Thank you very much for your help. I add the project files as zip-File.
PS:
this behaviour I don't have with LLBLGEN 4.2.
I updated from 4.2. to 5.4, and then there was this new "feature"
Attachments
Filename |
File size |
Added on |
Approval |
lgentest.zip
|
93,855 |
03-Aug-2018 12:56.17 |
Approved |