Although the brunt of features of Westwind.Globalization are geared towards ASP.NET, you can also use the data driven features using the DbResourceManager. DbResourceManager is a subclass of ResourceManager and loads resources from a database and can be used instead of the stock Resx ResourceManager.

Using the DbResourceManager

Using the DbResourceManager is easy enough:

DbResourceManager man = new DbResourceManager("Resources"); MessageBox.Show(man.GetString("Yesterday"));

Simply declare an instance of the resource manager with the name of the resource set to load and then access the manager as you would a standard ResourceManager.

Strongly Typed Resources
One issue to be aware of is that strongly typed resources will not work with your custom DbResourceManager as these resources are hard coded to use the ResourceManager class.

Configuration

DbResourceManager has the same requirements for configuration as the ASP.NET ResourceProvider, that is it needs to be configured via the DbResourceProvider section the application's config file (app.config in your non-Web project typically). A typical configuration looks like this:

<?xml version="1.0"?> <configuration> <!-- This section is required for configuration of the resource provider -->Ý <configSections> <!-- Custom Sections -->Ý <section name="DbResourceProvider" type="Westwind.Globalization.DbResourceProviderSection,Westwind.Globalization" requirePermission="false" /> <!-- End Custom Sections -->Ý </configSections> <!-- Using ConnectionStrings entry. You can also use a full SQL connection string. -->Ý <DbResourceProvider connectionString="LocalizationSamples" resourceTableName="Localizations" /> <!-- ResourceProvider Configuration section -->Ý <connectionStrings> <add name="LocalizationSamples" connectionString="server=.;database=DevSamples;integrated security=true;"/> </connectionStrings> </configuration>

The only things on the provider section that need configuration in non-Web applications is the connection string (either a raw string or connectionStrings entry as shown above) and the name of the table that holds localization data.