mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Adding disposable pattern to ShellContext
This commit is contained in:
@@ -92,7 +92,8 @@ namespace Orchard.Environment {
|
||||
BuildCurrent();
|
||||
|
||||
var shellContext = CreateShellContext(shellSettings);
|
||||
return new StandaloneEnvironmentWorkContextScopeWrapper(shellContext.LifetimeScope.CreateWorkContextScope(), shellContext);
|
||||
var workContext = shellContext.LifetimeScope.CreateWorkContextScope();
|
||||
return new StandaloneEnvironmentWorkContextScopeWrapper(workContext, shellContext);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -215,7 +216,7 @@ namespace Orchard.Environment {
|
||||
if (_shellContexts != null) {
|
||||
foreach (var shellContext in _shellContexts) {
|
||||
shellContext.Shell.Terminate();
|
||||
shellContext.LifetimeScope.Dispose();
|
||||
shellContext.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -352,7 +353,7 @@ namespace Orchard.Environment {
|
||||
|
||||
public void Dispose() {
|
||||
_workContextScope.Dispose();
|
||||
_shellContext.LifetimeScope.Dispose();
|
||||
_shellContext.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user