score:0
maybe you can solve this by thinking about it a different way. your join keys would be:
{ typeid, id } equals { 2, id }
maybe it's possible to use a constant as one of the two composite keys? see ladislav's composite key as foreign key answer.
score:1
you would have to do a manual join rather than relying on the navigational properties to create an implied join.
Source: stackoverflow.com
Related Query
- Linq with where clause in many-to-many EF Code First object
- How to query by where clause with EF code first
- EF Code First: Foreign Key With Where Clause?
- Code first The INSERT statement conflicted with the FOREIGN KEY constraint
- C# - Linq optimize code with List and Where clause
- map one to one with multiple primary key columns entity framework code first
- Entity Framework dynamic linq where from generic source with dynamic where clause
- lambda expression join multiple tables with select and where clause
- Linq Query with a Where clause in an Include statement
- Entity Framework retrieve data from table with foreign key
- Equivalence of query and method (lambda) syntax of a Join with Where clause
- Entity Framework - An item with the same key has already been added. - Error when trying to define foreign key relationship
- Why C# LINQ expressions must end with Select or Group By Clause where as no such restriction in VB.Net
- Linq-to-Entities: LEFT OUTER JOIN with WHERE clause and projection
- LINQ Where clause with Contains where the list has complex object
- How can i write SQL update query with where clause in Entity Framework in C#
- LINQ query with a WHERE clause with multiple conditions
- Linq query works with null but not int? in where clause
- SELECT AS in Linq with WHERE clause
- Linq where clause with multiple conditions and null check
- Entity Framework Core where clause with multiple values
- EF Navigation Property with null foreign key
- Dynamic Where Clause over relational tables with LINQ to SQL
- C# DynamicLinq where clause with Any()
- Linq to SQL: Where clause comparing a Nullable<DateTime> with a SQL datetime null column
- Linq where clause with multiple conditions
- linq query with dynamic predicates in where clause joined by OR
- LINQ: is there a way to supply a predicate with more than one parameter to where clause
- Left/outer join with linq on c# with where condition clause
- How to compare int with string in linq where clause
More Query from same tag
- Total row count in GridView control using LinqDataSource and paging
- C# Initialize an inherent object and get error "The entity cannot be constructed in a LINQ to Entities query"
- Inserting records on multiple tables in a single method using Entity Framework
- Look for words in strings with LINQ
- Select distinct Linq
- Dynamic query expression builder
- json.net Converting XML to JSON, how do I read / validate attributes
- How Build Lambda Expression Tree with multiple conditions
- LINQ: Using a pivot table in linq
- Null Reference Exception when attempting to bind dropdownlist inside formview
- LINQ query to query a list with array members
- LINQ Query (Group BY)?
- What is does expression<T> do?
- Fetch data using LINQ query with left join and AsExpandable()
- How to implement Linq OrderBy method?
- Merging multiple List<CustomType> when grouping in LINQ
- How to get all the data between two years in Entity frame work?
- MongoDB C#Driver resp. Linq: query for unique instances and using static AsQueryable Properties
- Adding a search to a linq query
- ADO.NET Entity Model and LINQ
- How to do joins in LINQ on multiple fields in single join
- LINQ-to-Entities get rid of sp_executesql
- Returning Linq query results into a List object (based on condition)
- An unhandled exception of type 'System.ArgumentNullException' occurred in System.Xml.Linq.dll Additional information: Value cannot be null
- Error on using count method in linq cannot to implecitly convert int to bool
- ExecutionEngineException with SQL and LINQ
- How to append further fields to select list item "Text" in MVC 3?
- Extra Columns While Converting Linq Result into Data Table
- How do I eager load a grandparent record in EF 4.1
- Linq group key is not unique