0

I have an APP which I tested local on my PC (Germany), after everything worked well I published it to AZURE as APP, SQL DB is in Azure too.

Now I have following problem:

Local PC with German Localization I can type "2,16" in a field and the database stored it right as 2.16.

After I publish the APP to Azure and I type "2,16" in a field, the database stored the value 216 (without comma or dot)...

Is there any possibility e.g in Startup.cs if the APP runs local or in Azure ?

I can do some code like this:

var webseite = Environment.GetEnvironmentVariable("WEBSITE_SITE_NAME");

and then check if website runs in AZURE, but this is ugly, it would be better if I can setup the Localisation once in startup.cs or anywhere else - hope someone have an idea to fix this without change code in every situation where I run to this problem... ?

Thanks for help Peter

Edit: the possible duplicate remark is not that what i am looking for - nothing from the given thread helps ? It is still that he use 216 instead of 2,16. When i type 2.16 he use correct value for updating the Database with EF Core.

fahr
  • 21
  • 1
  • 7
  • 1
    Possible duplicate of [Force locale with Asp.Net Core](https://stackoverflow.com/questions/42519068/force-locale-with-asp-net-core) – hujtomi May 09 '19 at 22:26
  • see Edit in Post - not what i`m looking for – fahr May 10 '19 at 05:26
  • I think the referenced link is indeed what you are looking for. the comma is not recognized in Azure as you expect because the local in Azure is English - as opposed to your German setting on your dev machine – silent May 10 '19 at 08:18
  • Can you please share your code where you transport 2,16 from a form to a number? – Mavi Domates May 10 '19 at 09:54

1 Answers1

0

This is what works as expected now with local and on AZURE too in Startup.cs:

 `public void Configure(IApplicationBuilder app, IHostingEnvironment env)
    {
        var cultureInfo = new CultureInfo("de-DE");
        cultureInfo.NumberFormat.CurrencySymbol = "€";

}`

thanks for the hint !

fahr
  • 21
  • 1
  • 7