My ASP.NET web app utilizes a custom resource provider backed by a SQL Server data store. As I understand it, implicit resourcing invokes the resource provider at compile-time to determine whether or not resource expressions need to be generated for the given resourcekey. Consequently, my build process is now dependent upon having a live, up-to-date database containing the necessary resource keys.
That in and of itself is not necessarily a problem. The issue is that the app connects to one of many databases as determined by a querystring parameter (terrible design, but unfortunately I am stuck with it for now). Obviously there is no querystring at compile-time, so the resource provider is unable to reach the database. Is it possible to determine that the resource provider (or more specifically code downstream of the resource provider) has been invoked during compilation so I can point to a predetermined database?
For now I am just defaulting to specific database if HttpContext.Current == null. This works fine, but this logic has to exist in the Data Access layer and I absolutely hate the idea of the Data Access tier referencing System.Web. Is there a better solution?