FetchEntityCollection with CAST expression for nText field

Posts   
 
    
chrishilton avatar
Posts: 49
Joined: 26-Jun-2007
# Posted on: 14-May-2008 11:51:35   

I'm using LLBLGen Pro 2.5 Final with adapter and .NET 2.0/c# connecting to both SQL Server 2000 and 2005 dBs.

I have recently implemented data paging and discovered that if the FetchEntityCollection method incorporates a join then LLBL Gen will include a Distinct statement within the SQL query. If a column in my table has a data type of nText (which is not compatible with the Distinct statement) then rather than returning a fixed number of records the method will return all the records.

I have worked around a similiar scenario with the FetchTypedList method by replacing the nText data type field in the fieldCollectionToFetch with a new field incorporating a cast expression.

Can anyone tell me if something similiar is possible with FetchEntityCollection as I obviously don't have a collection of fields to modify simply an EntityFactoryToUse?

I know that there's a override on FetchEntityCollection that accepts fields to exclude but I need the nText data type field to be returned so that option isn't possible for me.

Cheers, Chris

Walaa avatar
Walaa
Support Team
Posts: 14946
Joined: 21-Aug-2005
# Posted on: 14-May-2008 17:50:31   

I guess you may have 2 options:

1- Fetch the required paged rows using a DynamicList into DataReader, and then project it into an entityCollection.

2- Execlude the field from being fetched in the paged fetch method, then refetch the execluded fields into the collection. (FetchExcludedFields())