Ef6 + mysql bug, ef6mysqlbug

Source: Internet
Author: User

Ef6 + mysql bug, ef6mysqlbug

EntityFramework6 In the mysql database, a bug occurs when you sort by using linq.

Expression <Func <blog, bool> expr_filter = p => (area = ""? True: p. areaName = area );
IQueryable <blog> viewBlog = blogList_AllList.Where (expr_filter). OrderByDescending (p => p. createDate );

The above code will report an inexplicable nullrefrenceException

After trial, it is concluded that if expression uses the Three-object operator to implement dynamic SQL, it cannot use orderBy, and the two can only use one

Remedy: The expression does not use the three-object operator and is implemented using the if... else... condition.

At present, mysql does not seem to provide any solutions, and it is hoped that the trainees will not be killed.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.