FieldCompareRangePredicate + NOT IN

Posts   
 
    
jmcjq2
User
Posts: 26
Joined: 17-Nov-2009
# Posted on: 01-Sep-2010 10:15:12   

From the code below:



public EntityCollection<ClientEntity> GetAllAvailableParticipants(int EventId)
        {
            IEnumerable<EventParticipantEntity> participants = new EventBLL().GetParticipantsByEventId(EventId);
            int[] participantArray = participants.Select(i => i.EventId).ToArray();


            EntityCollection<ClientEntity> output = new EntityCollection<ClientEntity>();

            IRelationPredicateBucket bucket = new RelationPredicateBucket();

            bucket.PredicateExpression.Add(new FieldCompareRangePredicate(ClientFields.ClientId, null, participantArray));

            using (DataAccessAdapter adapter = new DataAccessAdapter())
            {
                adapter.FetchEntityCollection(output, bucket, 0);
            }

            return output;

        }


How do I make this a NOT IN expression


 bucket.PredicateExpression.Add(new FieldCompareRangePredicate(ClientFields.ClientId, null, participantArray));

This is the SQL syntax that I'm trying to come up with:

SELECT   ClientId
FROM         dbo.Client
WHERE    (ClientId NOT IN
                          (SELECT    ClientId
                            FROM          dbo.EventParticipant))

Thanks John

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 01-Sep-2010 10:36:46   

The FieldCompareRangePredicate Ctor has an overload that accepts a boolean negate parameter, please set that to true.

jmcjq2
User
Posts: 26
Joined: 17-Nov-2009
# Posted on: 02-Sep-2010 02:36:48   

Walaa wrote:

The FieldCompareRangePredicate Ctor has an overload that accepts a boolean negate parameter, please set that to true.

Got it! Thanks John