EDMX With lambda expression with MySQL
I am using EDMX with MySql 5.1. It is working fine except When I t开发者_开发百科ry to execute the lambda expression, it shows me the following error :- You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '[XYZ].[UserID] AS [UserID], [XYZ].[FirstName] A' at line 17
where [XYZ] is the table name and [UserID], [FirstName] are the columns of that table. Following is the statement, that I want to execute - _context.XYZSet.Where(org => org.ACDID == sbuID || !(org.ACDID.HasValue)).ToList();
Please help..
I do not know anything about EDMX, but from that error it looks like it's using MS SQL Server syntax to escape table and column names, which is not supported by MySQL. MySQL uses backticks for that, not square brackets.
If you could get EDMX to stop escaping the table and columns names then you might be okay, assuming none of the table/column names are reserved words.
精彩评论