views:

35

answers:

1

I'm working on a multilingual site written in asp.net using mvc 1.0. I was asked to switch from resources files to a database to allow my client to change the translation strings without need of restarting the service.

I wonder if it is possible to swap the translation at runtime with standard resource file.

Question:

How can I allow my client to replace the translations at runtime without need of downtime?

Here are the raw ideas howto solve the problem. Any thoughts are welcome:

  • Using IIS to graceful restart the app after resource satellite assembly was switched. Gracefully means that all new request use the updated assemblies. (Aren't the assembly files locked?)
  • Finally roiling my own resource provider (that reads xml file) and plug it in to the resource manager. (I've never done that so any help is welcome)
A: 

Yes, you can roll your own string resource lookup format instead of using what .NET has. It's been done before and I'm sure it'll be done again.

The obvious negative is that it has nothing to do with standard resources, so you're on your own in terms of tools, performance, and so on.

Steven Sudit
Is it possible to reload the satellite dll on runtime? This would alow me to stick with the standard resources
Piotr Czapla
In general, it is not possible to unload any assembly, except by loading it into an AppDomain and then removing the entire thing. I don't think this would be a good solution for resources, given the overhead of remoting between domains. Having said that, one possibility is to use satellite resource assemblies as the canonical store but caching them in a dictionary. In other words, load the assembly into an AppDomain, copy it into a local dictionary, then unload the AppDomain. Best of both worlds?
Steven Sudit