Quantcast
Channel: Web API
Viewing all articles
Browse latest Browse all 4850

Serializer runs in the new thread?

$
0
0

I have a Get (int Id) method in my controller that returns class instance.

Instance is created correctly(i can see that in the debugger) but on attempt to return

return classInstance;

my code crashes since it runs in the new thread and therefore setting culture to "en-US" .

Previously I have set default culture to "en-CA" which works beautifully on JsonConvert.SerializeObject(user,Formatting.Indented,settings).

How to fix the issue without modifying legacy code on classInstance. Is there a way to set culture for all threads within current request.

Or if you have some other idea.


Viewing all articles
Browse latest Browse all 4850


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>