IImplicitResourceProvider.GetImplicitResourceKeys called before InitializeCulture
I'm trying to implement a globalization solution based off the West Wind database resource provider. I am implementing the IImplicitResourceProvider interface to use implicit resources. However, the implicit resource keys are fetched by the provider in GetImplicitResourceKeys before InitializeCulture is called on the page. GetImplicitResourceKeys iterates over the set of resources that apply to the current resource set, so it needs to know what the culture is to have the correct set of resources.
I've tried setting the culture through the page directive, the web.config, manually setting the culture on the thread, and overriding InitializeCulture but it doesn't matter because the culture is never set before the implicit resources are fetched - GetImplicitResourceKeys is always hit before InitializeCulture. This all happens before PreInit is even fired.
We are using ASP.Net 4.0; I realize the West Wind solutio开发者_如何学Cn was written in 2.0. Has the page workflow changed since then? It doesn't make much sense to get the resources before the culture has been set though.
What do I need to do to make sure the culture is set before IImplicitResourceProvider.GetImplicitResourceKeys is called?
That would seem to be the correct behaviour, since GetImplicitResourceKeys only retrieves the keys, not the values.
You only need the culture when getting the actual resource values.
精彩评论