mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-09-18 17:47:54 +08:00
Reverting changes to WorkContextImplementation
--HG-- branch : 1.x
This commit is contained in:
@@ -8,7 +8,6 @@ namespace Orchard.Environment {
|
||||
class WorkContextImplementation : WorkContext {
|
||||
readonly IComponentContext _componentContext;
|
||||
readonly ConcurrentDictionary<string, Func<object>> _stateResolvers = new ConcurrentDictionary<string, Func<object>>();
|
||||
readonly ConcurrentDictionary<string, object> _states = new ConcurrentDictionary<string, object>();
|
||||
readonly IEnumerable<IWorkContextStateProvider> _workContextStateProviders;
|
||||
|
||||
public WorkContextImplementation(IComponentContext componentContext) {
|
||||
@@ -25,10 +24,8 @@ namespace Orchard.Environment {
|
||||
}
|
||||
|
||||
public override T GetState<T>(string name) {
|
||||
return (T)_states.GetOrAdd(name, (x) => {
|
||||
var resolver = _stateResolvers.GetOrAdd(x, FindResolverForState<T>);
|
||||
return resolver();
|
||||
});
|
||||
var resolver = _stateResolvers.GetOrAdd(name, FindResolverForState<T>);
|
||||
return (T)resolver();
|
||||
}
|
||||
|
||||
Func<object> FindResolverForState<T>(string name) {
|
||||
@@ -42,7 +39,7 @@ namespace Orchard.Environment {
|
||||
|
||||
|
||||
public override void SetState<T>(string name, T value) {
|
||||
_stateResolvers[name] = () => _states[name] = value;
|
||||
_stateResolvers[name] = () => value;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user