Windows DbResource Provider Service

I am developing a Windows service using C # 3.5 and I want to store language-specific resource strings in SQL Server and access them through DbResourceProvider. However, all the examples that I saw do not show how to install the resource provider in the Windows service (they all show the provider’s indication in the web.config file).

How to set up a resource provider in my windows service?

+4
source share
1 answer

Basically, DbResourceProvider based on the IImplicitResourceProvider and IResourceProvider interfaces - both interfaces are in the System.Web for a specific reason: they are specific to ASP.NET. They are NOT intended for use in nonASP.NET scripts (e.g. Windows Service, WinForms, etc.)!

A way to do something similar for nonASP.NET scripts is to implement your own IResourceReader and use it in a class derived from the ResourceManager - you can find an example with source code here .

+3
source

Source: https://habr.com/ru/post/1394896/


All Articles