diff --git a/src/Orchard.Web/Modules/Orchard.DesignerTools/Services/ShapeTracingFactory.cs b/src/Orchard.Web/Modules/Orchard.DesignerTools/Services/ShapeTracingFactory.cs index 6b93ab57a..31e09dc84 100644 --- a/src/Orchard.Web/Modules/Orchard.DesignerTools/Services/ShapeTracingFactory.cs +++ b/src/Orchard.Web/Modules/Orchard.DesignerTools/Services/ShapeTracingFactory.cs @@ -24,13 +24,13 @@ namespace Orchard.DesignerTools.Services { private int _shapeId; public ShapeTracingFactory( - WorkContext workContext, + IWorkContextAccessor workContextAccessor, IShapeTableManager shapeTableManager, IThemeManager themeManager, IWebSiteFolder webSiteFolder, IAuthorizer authorizer ) { - _workContext = workContext; + _workContext = workContextAccessor.GetContext(); _shapeTableManager = shapeTableManager; _themeManager = themeManager; _webSiteFolder = webSiteFolder; diff --git a/src/Orchard/Environment/WorkContextAccessor.cs b/src/Orchard/Environment/WorkContextAccessor.cs index 307ed2dd2..2390f4dfc 100644 --- a/src/Orchard/Environment/WorkContextAccessor.cs +++ b/src/Orchard/Environment/WorkContextAccessor.cs @@ -20,7 +20,7 @@ namespace Orchard.Environment { IHttpContextAccessor httpContextAccessor, ILifetimeScope lifetimeScope) { _httpContextAccessor = httpContextAccessor; - _lifetimeScope = lifetimeScope; + _lifetimeScope = lifetimeScope.Resolve(); } public WorkContext GetContext(HttpContextBase httpContext) { diff --git a/src/Orchard/Environment/WorkContextModule.cs b/src/Orchard/Environment/WorkContextModule.cs index 3b0b72444..e9475bed3 100644 --- a/src/Orchard/Environment/WorkContextModule.cs +++ b/src/Orchard/Environment/WorkContextModule.cs @@ -7,13 +7,12 @@ using Autofac; using Autofac.Builder; using Autofac.Core; using Autofac.Features.Metadata; -using Orchard.Mvc; using Module = Autofac.Module; namespace Orchard.Environment { public class WorkContextModule : Module { protected override void Load(ContainerBuilder builder) { - builder.Register(ctx => new WorkContextAccessor(ctx.Resolve(), ctx.Resolve())) + builder.RegisterType() .As() .InstancePerMatchingLifetimeScope("shell");