Using MySql with Entity Framework 4 and the Code-First Development CTP
Scott Guthrie's recent post on code-first development with Entity Framework 4 sparked interest in experimenting with it using MySql instead of Sql Server. However, configure Entity Framework 4 to generate the database automatically with MySql.
Exception:
The initial attempt resulted in a ProviderIncompatibleException, indicating that the NerdDinners database did not exist. Creating the database manually also did not resolve the issue, leading to a second ProviderIncompatibleException stating that "DatabaseExists is not supported by the provider".
Resolution:
After further exploration, a few key points emerged:
<code class="xml"><system.data> <DbProviderFactories> <add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.3.6.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" /> </DbProviderFactories> </system.data></code>
The above is the detailed content of How to Use MySql with Entity Framework 4 and Code-First Development: A Step-by-Step Guide?. For more information, please follow other related articles on the PHP Chinese website!