Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.NET MVC 3 Code First database collation

I'm trying to deploy my .NET MVC3 application without success. I have a datetime issue I'm not able to fix. Let me try to explain :

I have installed Microsoft visual web developper 2010 in French. My localization in control panel is French. When I code first my model and try to deploy my app I can see that my tables are created with SQL_Latin1_General_CP1_CI_AS collation which means English localization !??! Then I have, of course, a datetime issue with my production database. How can I change the collation of my SQLserver Compact database in dev to match my production database ? Why EF is creating my tables with english collation ??

Thanks for your help

like image 721
Dude Lebowski Avatar asked Jan 20 '26 22:01

Dude Lebowski


1 Answers

Acccording to http://msdn.microsoft.com/en-us/library/ms174596(v=sql.90).aspx

All databases that are created without specifying the Windows collation name are assigned Latin1_General, the default collation. Example: Latin1_General_CI_AS. This collation uses the Latin1 General dictionary sorting rules, code page 1252. It is case-insensitive and accent-sensitive.

As EF does not seem to support customizing this, I would suggest, if it's an option for you, to install SQL Server Express and use this instead, as SQL Server Express supports alternative default collations.

like image 81
Patrick McDonald Avatar answered Jan 23 '26 16:01

Patrick McDonald



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!