This article is a mirror article of machine translation, please click here to jump to the original article.

View: 26380|Reply: 0

[Source] ef (lambda expression) queries several exceptions encountered in the data

[Copy link]
Posted on 6/13/2018 3:36:50 PM | | | |
Entities or complex types "xxxx" cannot be constructed in LINQ to Entities queries.




I am querying table A, but I only want to query some fields in table A, because some field data is not used at all, and the amount of data is too large, which greatly affects performance in both query and data transmission.

https://www.cnblogs.com/GarsonZhang/p/8760973.html  If you want to ignore querying certain fields, this article is actually the wrong solution!

Because ToList() has already queried all the data.

The correct solution is to create a new B object, select the new B object and assign a value.





LINQ to Entities does not support the specified type member "Count". Only initial value settings, entity members, and entity navigation properties are supported.




The type of my Count field isuint type, change to int typeI don't know what the specific reason is!




Previous:There is a difference between Text and varchar(max) data types in SQL Server
Next:Use lambda expressions in Linq to Entity to implement Left Join and Join
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com