I'm used LLBLGen v5.8 with SelfServicing and the LLBLGen Pro Runtime Framework .
We have some performance issues in our application because we need to know in a lot of places how many records are in a related entitycollection.
An example: we have a entity Aanhef (Salutation) with a related 1:n entitycollection Personen (Persons).
Now we use the following code:
return aanhef.Personen.Count;
In this situation all the person-records are fetched which are linked to that salutation-record. We don't need the collection itself, we only need to know how much records there are.
I know that i need to use the GetDbCount() method on the AanhefCollection with a filter, which counts only the records via a quick SQL-server call.
To make it easer for our developers i want to add a method to all related entities via the generated code.
So i added the following code to entityInclude.template:
[Browsable(false)]
public int Get<[MappedFieldNameRelation]>Count()
{
return new <[RelatedEntityName]>Collection().GetDbCount(<[RelatedEntityName]>Fields.<[RelationFieldName]> == ID);
}
which produces the following generated code:
[Browsable(false)]
public int GetPersonenCount()
{
return new PersoonCollection().GetDbCount(PersoonFields. == ID);
}
My only problem is the placeholder <[RelationFieldName]> won't work (it results in an empy string).
I've searched in https://www.llblgen.com/Documentation/5.8/SDK/templates_tdl.htm to find a token with contains the value of the field 'Fk field name' from the Normal Relationship Editor, but didn't find it.
Can you please help me? Is there maybe a standard solution for this?