Apply field function using Prefetch path

Posts   
 
    
Posts: 44
Joined: 02-May-2014
# Posted on: 18-Jul-2014 10:51:55   

Hello,

Is it possible to apply a function on a field in a prefetch path ? :


var riskPrefetch = MaturityInvoiceEntity.PrefetchPathRiskCustomer;
riskPrefetch.ExcludedIncludedFields = new ExcludeIncludeFieldsList(false);
riskPrefetch.ExcludedIncludedFields.Add(RiskCustomerFields.LegalName); /* I'd like to trim this field */

var qf = new QueryFactory();
var q = qf.MaturityInvoice.WithPath(riskPrefetch);

In this sample, I'd like the field "LegalName" to be trim :

riskPrefetch.ExcludedIncludedFields.Add(RiskCustomerFields.LegalName.Trim());/*This code doesn't work*/

Thanks in advance, Regards, Etienne.

Walaa avatar
Walaa
Support Team
Posts: 14994
Joined: 21-Aug-2005
# Posted on: 18-Jul-2014 11:39:07   

Do you want the trimming to be done at the database side or at the code side (after fetching)?

Posts: 44
Joined: 02-May-2014
# Posted on: 18-Jul-2014 11:51:23   

On server side if possible.

For the moment, I process all the entity to apply the trim after fetching.

Thanks

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 18-Jul-2014 14:44:07   

On server side is not possible (easily) with entity fetches. You should use projections, available on Linq2LLBL and QuerySpec. See the documentation for examples.

David Elizondo | LLBLGen Support Team
Posts: 44
Joined: 02-May-2014
# Posted on: 18-Jul-2014 14:52:39   

Ok, I'll do that, thanks for your answer simple_smile