I am developing a Windows Service with c# 3.5 and want to store language specific resource strings within SQL Server and access them via a DbResourceProvider. All the examples I have seen however do not show how to set the resource provider within a Windows service (they all show specifing the provider within a web.config file).
How can I set the resource provider within my Windows service ?
Basically
DbResourceProvideris based on the interfacesIImplicitResourceProviderandIResourceProvider– both interfaces reside in the namespaceSystem.Webfor a reason: they are specific for ASP.NET. They are NOT intended for use in non-ASP.NET scenarios (like Windows Service, WinForms etc.) !The way to do something similar for non-ASP.NET scenarios is to implement your own
IResourceReaderand use it in a class derived fromResourceManager– an example with source code can be found here.