public object GetObject(string resourceKey, System.Globalization.CultureInfo culture)
{
Debug.WriteLine(String.Format(CultureInfo.InvariantCulture, "DBResourceProvider.GetObject({0}, {1}) - type:{2}", resourceKey, culture, this.m_classKey));
if (Disposed)
{
throw new ObjectDisposedException("DBResourceProvider object is already disposed.");
}
if (string.IsNullOrEmpty(resourceKey))
{
throw new ArgumentNullException("resourceKey");
}
if (culture == null)
{
culture = CultureInfo.CurrentUICulture;
}
string resourceValue = null;
Dictionary<string, string> resCacheByCulture = null;
// check the cache first
// find the dictionary for this culture
// check for the inner dictionary entry for this key
//if (m_resourceCache.ContainsKey(culture.Name))
//{
// resCacheByCulture = m_resourceCache[culture.Name];
// if (resCacheByCulture.ContainsKey(resourceKey))
// {
// resourceValue = resCacheByCulture[resourceKey];
// }
//}
// if not in the cache, go to the database
if (resourceValue == null)
{
resourceValue = m_dalc.GetResourceByCultureAndKey(culture, resourceKey);
// add this result to the cache
// find the dictionary for this culture
// add this key/value pair to the inner dictionary
//lock (this)
//{
// if (resCacheByCulture == null)
// {
// resCacheByCulture = new Dictionary<string, string>();
// m_resourceCache.Add(culture.Name, resCacheByCulture);
// }
// resCacheByCulture.Add(resourceKey, resourceValue);
//}
}
return resourceValue;
}