Bug #71282 | Error when inserting data using entity framework 6 on mysql 5.6 | ||
---|---|---|---|
Submitted: | 2 Jan 2014 22:29 | Modified: | 7 Feb 2014 22:26 |
Reporter: | Garvin Casimir | Email Updates: | |
Status: | No Feedback | Impact on me: | |
Category: | Connector / NET | Severity: | S2 (Serious) |
Version: | 6.8.3 | OS: | MacOS |
Assigned to: | CPU Architecture: | Any | |
Tags: | Code First, entity framework, migrations |
[2 Jan 2014 22:29]
Garvin Casimir
[6 Jan 2014 23:23]
Roberto Ezequiel Garcia Ballesteros
Hi Garvin, This error is because the default behavior for history table creates a composed primary key (using 2 columns). You can solve this using MySqlEFConfiguration class. It's important to create the instance of your context class as the first step in your code. You can find more information here: http://dev.mysql.com/doc/refman/5.6/en/connector-net-entityframework60.html Regards.
[6 Jan 2014 23:55]
Garvin Casimir
Ah, so the error has nothing to do with my actual application schema. If I use the MySqlEFConfiguration class then I can't use the dbconfig method to seed my data. I tried subclassing it but I got an error about the history configuration class not being in the same assembly as the dbconfig class. I guess I need to play around with this a little more.
[7 Jan 2014 22:26]
Roberto Ezequiel Garcia Ballesteros
Garvin, What MySqlEFConfiguration does to solve this problem is overriding history table operation to create only one column in the primary table instead of two. You can do the same (avoiding using MySqlEFConfiguration) using the following code inside your DbConfiguration class: SetHistoryContext(MySqlProviderInvariantName.ProviderName, (existingConnection, defaultSchema) => new MySqlHistoryContext(existingConnection, defaultSchema)); Hope this helps. Regards, Roberto
[8 Feb 2014 1:00]
Bugs System
No feedback was provided for this bug for over a month, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open".