Frage

In my ASP.NET MVC 4 application, I use two kinds of ResX files: "Right click/new/resx" for multiple language support, and programatically created resx files which are created based on the user's actions. The programatically created resx files are created in a custom (user's) folder, by the ResXResourceWriter class and are read by the ResXResourceReader class.

My questions are:

1, Will these programatically created resource files cached automatically by the web server, or should I use the MemoryCache and MemoryStream classes?

2, The dynamic creation of a resx file causes recompilation? If yes, I could use XML instead of ResX. Will the XML file be cached by the server?

On the part of the WEB API, my api controller return one string from the programatically created resources files. The AJAX method is in a "for" loop, so by "a page request" it will send many AJAX request for the controller.

My questions are:

1, Is this solution efficient? Won't cause performance hit because of the many api controller instances which are required to serve "one full page load" (around 1-10 single string request in a row)?

2, If the method described above is not efficient, I can send all of the string from the resx file in one trip, and the client sided script will do the rest of the work. If this is still not good, what kind of solution should I use?

War es hilfreich?

Lösung

Not really sure if you want to use user generated resx files? Are they user specific? Or just translations from one user for everybody?

But for dynamic resx files, I would suggest to use a DB Provider http://www.west-wind.com/presentations/wwdbresourceprovider/

As for the WebAPI: I would make one call that responds with all strings. Otherwise you have tons of requests and that will be slow for sure.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top