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.
<?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.