EF6 for MySql generates unwanted `[]` escape characters
<p>My application runs on both SQL Server and Mysql by switching configuration in <code>Web.config</code>.</p>

<p>I had just added a new entity and played with it in SQL Server. Okay, fine, let's switch.</p>

<p>All simple get statements work fine so I can navigate the pages. However, when I hit a <em>certain</em> Lambda query I get an unexpected and unwanted error</p>

<pre><code>        using (auitool2014Entities dataContext = GetDataContext())
        {
            return dataContext.sezione_a.Any(a =&gt;
                a.utente == utenteId &amp;&amp;
                startDateString.CompareTo(a.A21) &lt;= 0 &amp;&amp;
                endDateString.CompareTo(a.A21) &gt;= 0
                );
        }
</code></pre>

<p>Basically I need to check if there exists at least one row with the gien constraints (and yes, those date fields are stored as <code>yyyyMMdd</code> strings, so I will compare them).</p>

<p>The error I get is because EF6 generates square brackets to escape table names. Weird. Weird because when I hit the entity collection with a breakpoint I get the following</p>

<pre><code>{SELECT
`Extent1`.`A01`, 
`Extent1`.`A01a`, 
`Extent1`.`A01b`, 
`Extent1`.`A02`, 
`Extent1`.`A03`, 
`Extent1`.`A11`, 
`Extent1`.`A12`, 
`Extent1`.`A12a`, 
`Extent1`.`A12b`, 
`Extent1`.`A12c`, 
`Extent1`.`A21`, 
`Extent1`.`A22`, 
`Extent1`.`A23`, 
`Extent1`.`A24`, 
`Extent1`.`A25`, 
`Extent1`.`A31`, 
`Extent1`.`A31a`, 
`Extent1`.`A31b`, 
`Extent1`.`A32`, 
`Extent1`.`A33`, 
`Extent1`.`A33a`, 
`Extent1`.`A33b`, 
`Extent1`.`A33c`, 
`Extent1`.`A34`, 
`Extent1`.`A41`, 
`Extent1`.`A42`, 
`Extent1`.`A43`, 
`Extent1`.`A51`, 
`Extent1`.`A52`, 
`Extent1`.`A53`, 
`Extent1`.`A54`, 
`Extent1`.`A54a`, 
`Extent1`.`A54b`, 
`Extent1`.`A54c`, 
`Extent1`.`B11`, 
`Extent1`.`B12`, 
`Extent1`.`B13`, 
`Extent1`.`B14`, 
`Extent1`.`B15`, 
`Extent1`.`Z0`, 
`Extent1`.`prog`, 
`Extent1`.`utente`
FROM (SELECT 
    [sezione_a].[A01] AS [A01], 
    [sezione_a].[A01a] AS [A01a], 
    [sezione_a].[A01b] AS [A01b], 
    [sezione_a].[A02] AS [A02], 
    [sezione_a].[A03] AS [A03], 
    [sezione_a].[A11] AS [A11], 
    [sezione_a].[A12] AS [A12], 
    [sezione_a].[A12a] AS [A12a], 
    [sezione_a].[A12b] AS [A12b], 
    [sezione_a].[A12c] AS [A12c], 
    [sezione_a].[A21] AS [A21], 
    [sezione_a].[A22] AS [A22], 
    [sezione_a].[A23] AS [A23], 
    [sezione_a].[A24] AS [A24], 
    [sezione_a].[A25] AS [A25], 
    [sezione_a].[A31] AS [A31], 
    [sezione_a].[A31a] AS [A31a], 
    [sezione_a].[A31b] AS [A31b], 
    [sezione_a].[A32] AS [A32], 
    [sezione_a].[A33] AS [A33], 
    [sezione_a].[A33a] AS [A33a], 
    [sezione_a].[A33b] AS [A33b], 
    [sezione_a].[A33c] AS [A33c], 
    [sezione_a].[A34] AS [A34], 
    [sezione_a].[A41] AS [A41], 
    [sezione_a].[A42] AS [A42], 
    [sezione_a].[A43] AS [A43], 
    [sezione_a].[A51] AS [A51], 
    [sezione_a].[A52] AS [A52], 
    [sezione_a].[A53] AS [A53], 
    [sezione_a].[A54] AS [A54], 
    [sezione_a].[A54a] AS [A54a], 
    [sezione_a].[A54b] AS [A54b], 
    [sezione_a].[A54c] AS [A54c], 
    [sezione_a].[B11] AS [B11], 
    [sezione_a].[B12] AS [B12], 
    [sezione_a].[B13] AS [B13], 
    [sezione_a].[B14] AS [B14], 
    [sezione_a].[B15] AS [B15], 
    [sezione_a].[Z0] AS [Z0], 
    [sezione_a].[prog] AS [prog], 
    [sezione_a].[utente] AS [utente]
    FROM [dbo].[sezione_a] AS [sezione_a]) AS `Extent1`}
</code></pre>

<p>The first part is reasonably correct, but the second id strangely derived from SQL Server!!!</p>

<p>The following is my configuration:</p>

<pre><code>&lt;entityFramework codeConfigurationType="MySql.Data.Entity.MySqlEFConfiguration, MySql.Data.Entity.EF6"&gt;
    &lt;defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework"&gt;
      &lt;parameters&gt;
        &lt;parameter value="v11.0" /&gt;
      &lt;/parameters&gt;
    &lt;/defaultConnectionFactory&gt;
    &lt;providers&gt;
      &lt;provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" /&gt;
      &lt;provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6, Version=6.9.8.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" /&gt;
    &lt;/providers&gt;
  &lt;/entityFramework&gt;
</code></pre>

<p>How can I fix my problem?</p>