You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using MS Sql 2012.
Some times i get error "ExecuteScalar requires an open and available Connection. The connection's current state is closed."
This error i get in subclass of ViewLocalizer and RepositoryStringProvider :
// Caching view texts
public class CachedViewLocalizer : ViewLocalizer
{
private readonly ILocalizedViewsCache _cache;
public CachedViewLocalizer(IViewLocalizationRepository repository, ILocalizedViewsCache cache) : base(repository)
{
_cache = cache;
}
public override string Translate(string viewPath, RouteData routeData, string text)
{
string prompt;
if (_cache.TryGetValue(viewPath, routeData, text, out prompt))
return prompt;
if (prompt != null)
{
prompt = base.Translate(viewPath, routeData, text);// THIS LINE THROW ERROR
}
_cache.Insert(viewPath, routeData, text, prompt);
return prompt;
}
}
// caching type translations
public class CachedTypeLocalizer : RepositoryStringProvider
{
private readonly ILocalizedTypesCache _cache;
public CachedTypeLocalizer(ILocalizedTypesRepository repository, ILocalizedTypesCache cache) : base(repository)
{
_cache = cache;
}
protected override string Translate(Type type, string name)
{
var promptName = type.FullName + "." + name;
string prompt;
if (_cache.TryGetValue(promptName, out prompt))
return prompt;
prompt = base.Translate(type, name);
if (prompt != null)
{
_cache.Insert(promptName, prompt);
}
return prompt;
}
}
After re-build of project everything works again.
So i think, Griffin.MvcContrib close connection.
Maybe some suggestions?
Thanks, Roman
The text was updated successfully, but these errors were encountered:
I am using MS Sql 2012.
Some times i get error "ExecuteScalar requires an open and available Connection. The connection's current state is closed."
This error i get in subclass of ViewLocalizer and RepositoryStringProvider :
After re-build of project everything works again.
So i think, Griffin.MvcContrib close connection.
Maybe some suggestions?
Thanks, Roman
The text was updated successfully, but these errors were encountered: