lundi 25 mai 2015

How to read a resx from the main project through a reference?

I have a web application with an App_GlobalResources folder that contains some resx files.

I can read it using the following code :

Dim rm As ResourceManager = New ResourceManager("Gabarit.Web.Langue", Reflection.Assembly.GetExecutingAssembly())
ViewData("holder") = rm.GetString("key001")

I want to move that code in a referenced assembly (a "common" dll). I though I'd only need to use Reflection.Assembly.GetEntryAssembly() but I get a null ref exception.

The goal is to have a strategy pattern in that DLL, so I can decide to get my strings from the resx or from some other sources without touching much of the [web application] code.





Aucun commentaire:

Enregistrer un commentaire