score:1
Accepted answer
this will work in efv4. try it in efv1:
var tagids = new int[] { 6, 7 };
var query = context.tags
.where(t => tagids.contains(t.id))
.selectmany(t => t.posts);
edit:
i checked it and collection valued parameters + contains
were added in efv4 so above example doesn't work in efv1. this thread in msdn forum provides workaround to allow in operator in efv1. another recommended workaround is simply upgrade to efv4 because there are many other improvements including significant improvement of performance.
Source: stackoverflow.com
Related Query
- Query a many to many relationship with Entity Framework and .NET 3.5
- How to query many-to-many relationship with 'AND' condition using LINQ and Entity Framework
- Proper Linq Query for objects with many to many relation ship generated with code first entity framework
- Entity Framework - Linq query with order by and group by
- Always encrypted with Entity Framework and Includes fails to materialise query
- query and create objects with a one to many relationship using LINQ
- Using Linq to query Entity Framework with Where clause and many-to-many relation
- Binding query to datagrid with WPF and Entity Framework
- Linq query with many to many relations using entity framework
- entity framework with linq query and stored expression error
- Can I limit how many levels the .include adds with LINQ and Entity Framework 5?
- Counting occurrences in a many to many table with Entity framework and LINQ
- Searching for multiple strings using single database query with entity framework and LINQ
- how to write a Linq query with a EF code first Many to Many relationship
- Joining or Including multiple tables with Entity Framework Core LINQ to Entities - One to Many and then Many to One
- How can I convert Sql query to Linq and its equivalent with Join() method in Entity Framework Core
- How to translate a query with an EntityState and a value from Entity Framework 5 to 6?
- Map SQL with JOIN, GROUP BY, and SUM to Entity Framework query
- How to select a query with multiple columns and put it into variables using Entity Framework and ASP.NET?
- Entity Framework with an Intersect table and correspond Linq query
- Entity Framework - How to improve query with many-to-many relationship
- Translating datediff LINQ query to SQL with Entity Framework Core and .NET Core 3.1
- How to run linq query on many-to-many relationship in c# with entity framework
- How to return just first parent element, but many children and grandchildren in Linq with Entity Framework - SYBASE ASE Connector bug
- Dynamic query with OR conditions in Entity Framework
- Entity Framework Core: many-to-many relationship with same entity
- EF - AND NOT EXISTS (SELECT 1 ...) with Entity Framework
- How to avoid memory overflow when querying large datasets with Entity Framework and LINQ
- Use a Inline Table-Valued Functions with Linq and Entity Framework Core
- Using a enum with flag in an Entity Framework query
More Query from same tag
- LINQ Multiple Sort Dynamically C#
- Linq Join with a Group By
- Order LINQ by "string" name
- LINQ - Join two DataTables, multiply 3 columns, and then get grand total sum
- Is there a list to compare the properties of items between two lists?
- Find the newest item in a C# generic list using Linq
- Calculate Max and Min Dates with LINQ2XML
- Use LINQ to group multiple columns & split data into several lists
- Adding String to List MVC
- How to iterate over results of a linq-to-sql query result and append the results?
- IQueryable and Count
- Can I improve this linq query somehow?
- Linq2Sql -> Searching the database against a local collection of values - "Queries with local collections are not supported"
- how to convert this T-SQL statment to linq
- Compare DateTime with milliseconds in LINQ
- Get results matching a list of Ids using Linq
- Conditional Addition of elements in to a list in C#
- Lambda Expression +IEnumerable+ C#+ Where+Contains
- Equivalent C# LINQ code for SQL
- Azure DocumentDb - Query Spatial Data
- EntityFrameworkCore GroupBy Select FirstOrDefault() SystemInvalidOperationException
- Linq OrderBy calculated property
- Linq Select with Where based on Dropdown values
- Entity Framework query joins and group by issue
- Find least Rate in a List<T> in a specific group
- What is the difference between an operation with foreach loop and LINQ?
- What is the equivalent of this SQL query in linq
- Linq Query Either Null Exception or No Results
- Input string was not in a correct format error, but still able to get parsed value from LINQ to XML query
- convert rows into columns in linq