score:6
Accepted answer
assuming you've got one-to-many association between candidates and candidatelocations
context.candidates.where(c => c.isarchived == 0 &&
!c.candidatelocations.any(
l => l.countryisocode == location && l.restrictionstatus == 2) &&
(c.candidatelocations.any(
l => l.countryisocode == location && l.restrictionstatus == 1) ||
!c.candidatelocations.any(
l => l.restrictionstatus == 1))
);
Source: stackoverflow.com
Related Query
- Linq Navigation Properties complex where ID in (select id from...)
- Entity Framework Linq Query: How to Where on Multiple Nav Properties and Select from 3rd Nav Property
- C# LINQ select from where value is not contained in array / list
- linq select from database where ID in an ArrayList
- LINQ select List where sub-list contains item from another list
- Select items from a List where the children contain the items from another List using LINQ
- linq how to select the parent from a collection where the parent contains child items in another collection
- How to use Linq to select and group complex child object from a parents list
- LINQ Query Using Navigation Properties Generates Multiple SELECT Statements
- using linq select from list data where
- How to select distinct employees with LINQ based on ID from an employee collection where employee 's salary is 2nd highest?
- creating Linq to sqlite dbml from DbLinq source code
- LINQ select from table where fieldValue is in another tables list of values
- Linq select from list where property matches a condition
- Linq query with select needed to get specific properties from a list
- LINQ Lamba Select all from table where field contains all elements in list
- LINQ to SQL - FROM X WHERE X = "1" SELECT Y
- c# - Linq select properties from List of objects and modify them with shorthand conditional
- How do i use linq and select just a Sum of values(field) from a datatable along with a where clause?
- Linq Include Select from Navigation Property
- Complex IEnumerable Result from LINQ Select
- Linq select from database table where matching property from List
- Linq Query using navigation properties and Where clause
- Select distinct DateTime properties from List<IDictionary<string,object>> using LINQ
- select columns where one from columns contains value is it possible ? in linq
- Using a Linq query to select objects where any value of a property matches values from a list
- Linq select a value based on where condition from other table
- MongoDB linq C# select document where array of subdocumnets contain all values from string array
- Coalesce fields in a .net MVC 4 model without getting "Only initializers, entity members, and entity navigation properties are supported" from LINQ
- LINQ query to conditionally filter on a where clause and select the values from another table
More Query from same tag
- how to find last version no from a list<> in C#
- Creating a string from a lambda expression
- How to Combine 2 Result (add Column) from Linq Select into 1 Table or CrossJoin in ASP.Net Core
- How to get the last element of a Collection Navigation property
- C# Dealing with whitespaces
- specified cast is not valid in casting int to byte
- Order by is not working in MVC Linq query
- WCF Service LINQ Query to signin a user
- Using Linq to concatenate a list of property of classes
- How unique is LINQ?
- Find an item in a generic list by specifying multiple conditions
- How do I combine multiple linq queries into one results set?
- i:nill="true" appears in response
- How to convert this Linq query syntax to method syntax?
- Entity Framework - Group and Min
- Linq to DocumentDB: filter by datetime field
- Filtering data from Entity Framework
- Getting all indexes of matching elements in string array
- Request values from query string
- Stepping through Linq statement tips
- LINQ group by then order groups of result
- Counting Column Rows using return JSON and Linq on google charts
- Get max & min from Entity Framework, in one query and with best query possible
- c# - LINQ select from Collection
- Dynamic Linq To Sql With ComboBox and Column.Contains
- Entity-Framework Join Explanation
- Which LINQ statements force Entity Framework to return from the DB?
- Can I use an anonymous type for this Linq grouping?
- read xml attributes
- select max (column) using linq