0

How to search int[] QTaskId in Entity. i try to make below but i can not


void (Run(int[] QTaskId)
{
 var Que = calculateCtx.QTaskRelations.Where(q => q.QTaskId.Contains(QTaskId)).Select(q => q);
}

2 Answers 2

3

I think you've just got the contains wrong. Instead of this:

Where(q => q.QTaskId.Contains(QTaskId))

try this:

Where(q => QTaskId.Contains(q.QTaskId))

I would also suggest changing your parameter name to something more easily understandable, such as "validTaskIds" (note the plural, as well as the camelCased name). Then:

Where(q => validTaskIds.Contains(q.QTaskId))
Sign up to request clarification or add additional context in comments.

Comments

2

You have to look the other way around: you have to search the "QTaskId" array for "q.QTaskId":

void (Run(int[] QTaskId)
{
 var Que = calculateCtx.QTaskRelations.Where(q => QTaskId.Contains(q.QTaskId)).Select(q => q);
}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.