Hello,
Working with llblgen from yesterday, and testing some with a small database with little data in it, I stumbled on a very weird issue with many to one relations.
The following tables are used in this example:
User
UserID (PK, Entity)
Name
GroupID (FK referencing Group.GroupID)
Group
GroupID (PK, Entity)
Name
In the table the relevant data is as follows :
user: (1, Nico, 1)
group: (1, Group1)
I was using the following code:
UserEntity me = new UserEntity(1);
foreach (UserEntity them in me.Group.User)
{
Response.Write("user: "+them.Name+"<br>");
}
Hower this code printed 2 users for me, wich are exactly the same. This should not be the case, only 1 user is added to Group 1!
But when fetching the same user from the group using the below code it returned only 1 user as it should:
GroupEntity group = new GroupEntity(1);
UserEntity me = group.Gebruiker[0];
foreach (UserEntity them in me.Group.User)
{
Response.Write("user: "+them.Name+"<br>");
}
I find this very weird, considering the fact the code basically should do the same but well, it doesn't.
I can't seem to find a Count, Length or Size in the collections either, which would be nice to have to test how many Entities it finds in a collection.
Maybe i'm doing something wrong here, but I think the code should work just fine..
Thanks in advance.
Regards,
Dordanov