Hi all,
Using llbl 5.5, SQLServer2017
I am trying to use a single bucket to fetch 4 different type of entity, let me explain :
I have a viewEntity(GlTransactionEntity) which is based on 4 children entity (IC,JC,AR and APTransaction), doing a GetEntities on the view entity is too slow because of the way we made our database, so instead i need to fetch all the entities by fetching the 4 children entity one after the other with the same filter and then make the view entity based on them.
The problem is that I want to do it so that the next person using my fetch method won't have to make 4 different RelationPredicateBucket.
Is there any way i can construct my Bucket using, let say ,GLTransactionFields.Id and then change the instance of GLTransactionFields.Id to ICTransactionFields.Id before fetching?
Or maybe i can use a Custom Relation and when using fetch entity on GLTransaction the query knows to fetch the Ic,Jc,Ar,Ap based on the filter instead of the Gl directly
CustomRelation.AddEntityFieldPair(EntityFieldFactory.Create(GlTransactionFieldIndex.Id),
EntityFieldFactory.Create(IcTransactionFieldIndex.Id));
CustomRelation.AddEntityFieldPair(EntityFieldFactory.Create(GlTransactionFieldIndex.Id),
EntityFieldFactory.Create(JcTransactionFieldIndex.Id));
CustomRelation.AddEntityFieldPair(EntityFieldFactory.Create(GlTransactionFieldIndex.Id),
EntityFieldFactory.Create(ApTransactionFieldIndex.Id));
CustomRelation.AddEntityFieldPair(EntityFieldFactory.Create(GlTransactionFieldIndex.Id),
EntityFieldFactory.Create(ArTransactionFieldIndex.Id));
and instead of doing :
var Bucket = new PredicateExpression(IcTransactionFields.DetailSourceTypeCode == "REC");
IcManager.Fetch(Bucket)
Bucket = new PredicateExpression(JcTransactionFields.DetailSourceTypeCode == "REC");
JcManager.Fetch(Bucket)
Bucket = new PredicateExpression(ArTransactionFields.DetailSourceTypeCode == "REC");
ArManager.Fetch(Bucket)
Bucket = new PredicateExpression(ApTransactionFields.DetailSourceTypeCode == "REC");
ApManager.Fetch(Bucket)
I could do :
var Bucket = new PredicateExpression(GENERICFIELD.DetailSourceTypeCode == "REC");
IcManager.Fetch(Bucket);
JcManager.Fetch(Bucket);
ArManager.Fetch(Bucket);
ApManager.Fetch(Bucket)
)
or something of the sort.
The last solution i thought of would be to make a field that changes based on the entity that i want to fetch at runtime but i doubt that is possible.
Thank you for your help