score:2
Accepted answer
var codes = boxes.select(c => c.inventory.productcode).tolist();
int placeid = (int)model.placeid;
var products = generalcontext.inventory
.join(generalcontext.products,
invtry => invtry.productid,
prdct => prdct.productid,
(invtry, prdct) => new { inventory = invtry, product = prdct })
.where(q =>
q.inventory.placeid == placeid &&
q.inventory.inventorystatu == (int)enums.reason.stok &&
q.product.iswithrecipe == false &&
codes.contains(q.inventory.parentproductcode))
.tolist();
Source: stackoverflow.com
Related Query
- Only primitive types or enumeration types are supported in this context- linq join
- Entity Framework Linq Query to List - Error when using contains: Only primitive types, enumeration types and entity types are supported
- C# - Linq : Unable to create a constant value of type Only primitive types or enumeration types are supported in this context.
- LINQ related error "Unable to create a constant value of type 'System.Object'. Only primitive types or enumeration types are supported in this context
- LINQ query. Only primitive types or enumeration types are supported in this context
- Linq Multiple join to 'Only primitive types or enumeration types are supported' Error
- LINQ Query error: Unable to create a constant value of type. Only primitive types or enumeration types are supported in this context
- Linq update error Only primitive types or enumeration types are supported in this context
- Unable to create a constant value of type ''. Only primitive types or enumeration types are supported in this context. ASP.NET MVC LINQ EF
- Linq receiving unable to create value type of model, only primitive types or enumeration types are supported
- Linq to Entities: Only primitive types or enumeration types are supported in this context
- Unable to create a constant value of type 'Anonymous type'. Only primitive types or enumeration types are supported in this context two db Linq query
- Linq with expect: Only primitive types or enumeration types are supported in this context
- Linq Any - Only primitive types or enumeration types are supported in this context
- Only primitive types or enumeration types are supported in this context in linq
- Unable to create a constant value of type Only primitive types or enumeration types are supported in this context
- linq, unable to create a constant value of type yyy. only primitive types or enumeration types are supported in this context
- Cannot compare elements of type 'System.Collections.Generic.ICollection`1 Only primitive types, enumeration types and entity types are supported
- Only primitive types or enumeration types are supported in this context
- Only primitive types or enumeration types are supported in this context
- Unable to create a constant value of type 'Anonymous type'. Only primitive types or enumeration types are supported in this context
- EntityFramework Unable to create a constant value of type 'Anonymous type'. Only primitive types or enumeration types are supported in this context
- unable to create a constant value of type 'yyy'. only primitive types or enumeration types are supported in this context
- Only entity types, enumeration types or primitive types are supported in this context
- Unable to create a constant value of type 'IdentityUserRole'. Only primitive types or enumeration types are supported
- Unable to create a constant value of type 'x'. Only primitive types or enumeration types are supported in this context
- Asp.Net - Unable to create a constant value of type. Only primitive types or enumeration types are supported in this context
- EF - Unable to create a constant value of type Only primitive types or enumeration types are supported in this context
- `Only primitive types or enumeration are supported in this context` error whilst seeding ASP.NET MVC using AddOrUpdate match on multiple fields
- Unable to create a constant value of type ' ' . Only primitive types or enumeration types are supported in this context
More Query from same tag
- LINQ Project properties into a new anonymous type with Contains
- LINQ to Entities - sort by array
- How can I use external method in LINQ OrderBy
- DeleteObject from multiple tables
- Get unique users per hour/day/month
- LINQ complex query navigation property
- using Linq to iterate over an array and create a new List of objects?
- LINQ to Entities custom method
- Linq Join with GroupBy and Sum
- How to display all row data rather than just diplaying first row using SQL Query in MVC
- Find value via property name in json.net?
- Create linq extension method that takes a property and function and executes that function on that property
- Simple query performance
- Linq to compare 2 different lists and select the outer join
- Query Parent's record where condition on a Grandchild
- Is the from keyword preferable to direct method calls in C#?
- IEqualityComparer<T> does not work with List<T>.Distinct() method
- Is there a way to use C# 9.0 conditional expressions in a C# 7.3 project?
- linq to sql startwith performance indexed columns
- Partition By Logic in Code to calculate value of a DataTable Column
- How do i obtain foreign table field using string value for fieldname with reflection and entity framework
- Find possible variations of one item
- Order by 3 columns value String.Length
- Performing linq search using substring - is there a better way?
- return a class directly from a linq query
- How to pass output of a linq query to another form in C#
- Can I rewrite this LINQ to XML better?
- Threading / Linq Class list Issue
- Linq statement to get a string that is not substring of a longer string
- Expression<Func> method gives convertion error when used in linq query