ResourceManager vs. ConfigurationManager

  • Thread starter Thread starter Yanir
  • Start date Start date
Y

Yanir

Hello,
I am currently designing a framework for rapid .NET development of
ASP.NET applications.

We are concidering keeping our error messages and other string
constants outside the code with some sort of a resource manager.
We are already using Microsoft's Configuration Application Block to
store other attributes of our application.

Should I use ResourceManager in order to store my string constants or
should I use ConfigurationManager (from the application block)?

I know that ResourceManager specializes in keeping application
resources, but what exactly is the difference?
The way I see it, the configuration manager is able to extract strings
out of an XML file just as well as the resource manager. If we would
want to change the culture we could simply write a new XML file and
direct the configuration manager to that file instead.
It also supports caching of the configuration data, and I actually see
no problem with using it to hold all of our string constants.

Any information on the subject would be very helpful.

Thanks in advance,
Yanir
 
It depends on your scalability and performance needs. If you plan on having
a LOT of strings in your resource file, or if you plan on localizing to
several other languages you should use the ResourceManager and create
compiled resource files vs xml files. XML is a memory pig and its slow
compared to reading a compiled resource file.
 
Thanks John,
but I tend to disagree about the performance issue.

First, the Configuration Application Block supports caching. Once the
file is initially loaded the data exists in memory for as long as the
application is alive. When talking about an ASP.NET application, the
loading of the file occurs only once for all users.
In that case I don't care if the loading takes a few seconds more.

Second, the Configuration Application Block supports storing the data
inside SQL Server. I presume loading a lot of strings from database
shouldn't be significantly slower then loading them from a compiled
resource file. Storing the information in database also seems easier to
maintain then a giant resource file.

Last, the Configuration Application Block supports storing of any user
defined object. I'm not sure if that's going to help me in this
specific case, but it seems more flexible than just storing strings.

I still see no pros in using the ResourceManager for that purpose.
Any ideas anyone?

Yanir
 
Back
Top