Bug: Entity Framework keyword column name not escaped
Posted: Tue 22 Jun 2010 12:10
Hello,
I am evaluating the MySql provider for Entity Framework, but I have hit a bug which doesn't allow me to finish my testings. One of the tables in the DB I am using has a column named "level". This however appears to be a reserved keyword, which isn't escaped in the query leading to an SQL error and an EntityCommandExecutionException:
I can't change the database, because I don't own it, so can someone provide a fix or a workaround?
The exception is:
I am evaluating the MySql provider for Entity Framework, but I have hit a bug which doesn't allow me to finish my testings. One of the tables in the DB I am using has a column named "level". This however appears to be a reserved keyword, which isn't escaped in the query leading to an SQL error and an EntityCommandExecutionException:
Code: Select all
SELECT
Extent1.id AS id,
Extent1.test_id AS test_id,
Extent1.name AS name,
Extent1.release AS release,
Extent1.level AS level, <---- ### HERE ###
Extent1.state_id AS state_id,
Extent1.completed_shifts AS completed_shifts,
Extent1.`delete` AS `delete`
FROM mydb.mytable AS Extent1
WHERE Extent1.test_id = :EntityKeyValue1
The exception is:
Code: Select all
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 'release,
Extent1.level AS level,
Extent1.state_id AS state_id,
Extent1.com' at line 5
at System.Data.EntityClient.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior)
at System.Data.Objects.Internal.ObjectQueryExecutionPlan.Execute[TResultType](ObjectContext context, ObjectParameterCollection parameterValues)
at System.Data.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption)
at System.Data.Objects.ObjectQuery`1.Execute(MergeOption mergeOption)
at System.Data.Objects.DataClasses.EntityCollection`1.Load(List`1 collection, MergeOption mergeOption)
at System.Data.Objects.DataClasses.EntityCollection`1.Load(MergeOption mergeOption)
at System.Data.Objects.DataClasses.RelatedEnd.Load()
at System.Data.Objects.DataClasses.RelatedEnd.DeferredLoad()
at System.Data.Objects.DataClasses.EntityCollection`1.GetEnumerator()