Allowing Duplicates

Posts   
 
    
Gianc1412
User
Posts: 40
Joined: 30-Oct-2007
# Posted on: 01-Nov-2007 15:41:03   

Im using the method below to select distinct a typed list, but distinct is not being emitted during the SQL trace. For example, I'm using the same method with different typed lists and I am getting a select distinct emitted (SELECT DISTINCT TOP 10000). But in the case below all I'm getting is (SELECT TOP 10000).

public static CustomMessageListTypedList GetCustomMessageBySubProductName(string SubProductName) { CustomMessageListTypedList customMessageList = new CustomMessageListTypedList();

        IPredicateExpression selectFilter = new PredicateExpression();
        selectFilter.Add(PredicateFactory.CompareValue(IssueTrackerSubProductsFieldIndex.SubProductName, ComparisonOperator.Equal, SubProductName));

        customMessageList.Fill(10000, null, false, selectFilter);

        return customMessageList;

}

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 01-Nov-2007 16:07:16   

Do you have any binary/blob fields in the resultSet, like image, text fields?

Gianc1412
User
Posts: 40
Joined: 30-Oct-2007
# Posted on: 01-Nov-2007 16:10:30   

Ha, you guessed it, I got the answer from our senior developer right as your post came in. It's a text field so it can't be done.

I was thinking that the DISTICT would still be emitted but throw an exception at runtime.

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 01-Nov-2007 16:12:48   

I was thinking that the DISTICT would still be emitted but throw an exception at runtime

LLBLGen Pro is smart enough simple_smile

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 02-Nov-2007 12:26:55   

Walaa wrote:

I was thinking that the DISTICT would still be emitted but throw an exception at runtime

LLBLGen Pro is smart enough simple_smile

Indeed simple_smile (Unlike Linq to sql wink )

If it can't use distinct, it switches to client-side filtering of duplicates, so it will fetch objects only if they're not in the cached set of entities already in the set fetched/collection.

Frans Bouma | Lead developer LLBLGen Pro