Search code examples
c#internationalizationdecimal-point

How to return formatting type Double mapping in NHibernate


We're developing an application with C #. NET, using MVVM, Nhibernate. I noticed a strange behavior, to get data from database and put on a Grid: The data in the database that are of type Double, ie, 115,34, are returned through the mapping to the field with point (.) instead of comma (,), being 115.34.

Well, how I could do , to NHibernate returns data like it's set into the database? He has to return as the Regional Settings of the machine (in this case, is set to comma, but if it's set to point, have to return point).

Thanks in advance.


Solution

  • Solved!

    Added this to my Startup Class:

     FrameworkElement.LanguageProperty.OverrideMetadata(typeof(FrameworkElement),
                    new FrameworkPropertyMetadata(XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag)));
    

    Now it's getting the Regional Settings. What is strange, I've thought it was Nhibernate issue. It's a WPF issue....

    Thanks again!