Entity Framework 5.0 and onwards culture specification problem when using comma for decimal separator like (Turkish collation) RRS feed

  • Question

  • Hi everyone,

    I have a problem when using Entity Framework 5.0 and onwards over mysql database. My application and all other dll libraries on .net framework 4.5.2. And all the threads using Turkish Culture there is no problem in it. CultureInfo.DefaultThreadCurrentCulture and CultureInfo.DefaultThreadCurrentUICulture are also set to Turkish Culture. Mysql database and tables have Turkish Collation. If I use this program on a Turkish regional settings enabled pc there is no problem. However, when I change the regional settings to english, problem arises.

    Problem is : (My problem occurs when I get data from database using EntityFramework 5.0 or onwards.)

    Although I changing all thread culture settings to Turkish, data is mapping to entity class with windows regional settings.

    Properties are in wrong collation. Lets say entity class "product" and it has a double type property named as "Price". I'm waiting a double value with comma but value has dot for decimal separator. 

    My consideration  is Entity Framewok doesn't look at CultureInfo.DefaultThreadCurrentUICulture, it always using Windows Regional Language Settings. How can I achieve this problem?

    While I was using EntityFramework 4.0, I didnt have this problem. 

    Thank you.

    Best Regards.

    Tuesday, August 11, 2015 10:45 AM