Last post Feb 19, 2010 03:47 AM by AsM4U
Feb 18, 2010 08:03 AM|AsM4U|LINK
In our web application we need to keep various company's settings. For eg "Shippingpickup","ZipCodeCaption","DefaultCountry","AllowToEditInvoice", etc
These settings are different for various companies and are placed in web.config as key-value pair.
Initially, we have tried do simplify this process by adding a company_settings table in the DB so as to allow us to add companies on the fly. However, this method makes it very difficult to add a new setting since it would require us to add a column to the
company_settings table and thus would require code changes as well as stored procedure changes.
Now we have added separate global resource files for each company's settings. But, whenever we want to add new company to our website, we need to add a new resource file for that company. Adding a resource file requires compilation, and thus the application
needs to be restarted. I was wondering if there is a way that we can add a new resource file dynamically at run-time.
Or are resource files not the right thing to use here? Is there a better method of tackling this issue?
Feb 18, 2010 09:40 AM|jgangwisch|LINK
You can add a resource file dynamically at runtime. Here is some code:
dim rm as new ResourceManager("MyApplication.res",Assembly.GetExecutingAssembly())
dim ZipCodeCaption as string = rm.GetString("ZipCodeCaption")
The other method I would think would be better for this scenario is the Profile Manager. This allows you to assign different values based upon the user.
Feb 19, 2010 12:02 AM|AsM4U|LINK
Thanks jgangwisch for your early reply.
Resource manager's way is good to solve this problem.
I am talking about ADDING new resource files dynamically & not loading existing resources.
So, can we still go ahead with this approach ?
Feb 19, 2010 03:47 AM|AsM4U|LINK
I found out that resource file only loads resource keys.It doesnt creates new resources dynamically at runtime.