I have been working with Entity Framework 4 and MySQL. The main problem I have found is that since I am working on a Windows server, the table names in the database are all lower case. This means that when I create the entities in Visual Studio, the classes are all lower case.
So I have found this solution:
There is a setting in the configuration file in the MySQL server directory. I am using Windows 7, so this was under: C:\Program Files (x86)\MySQL\MySQL Server 5.5C:\Program Files (x86)\MySQL\MySQL In this Server 5.5\.
In this directory, you will find a file: my.cnf. This governs how MySQL runs. You will need to change or add a line to allow Camel casing of table names. Please note that you should read http://dev.mysql.com/doc/refman/5.0/en/identifier-case-sensitivity.html. This details the changes and how they should be used on different Operating Systems. I am only detailing how I got this to work on Windows. If you are running Linux, then please go to the link mentioned above to make sure that the change will not affect your system / MySQL instance.
Steps taken to allow Camel casing:
- Go to Control Panel –> Administrative Tools –> Services.
- Stop the MySQL Service.
- Open C:\Program Files (x86)\MySQL\MySQL Server 5.5C:\Program Files (x86)\MySQL\MySQL In this Server 5.5\.
- Open the my.cnf file as Administrator.
- Add the line
lower_case_table_names=2 under the
mysqld section. If this line is there, then just change the value to ‘
2’. Make sure that there is only one line there.
- Go back to Services and restart MySQL.
You should be done. Hope this short guide has helped.