mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
#18282: Resolving WorkContext the correct way in ShapeTracing
Work Item: 18282 --HG-- branch : 1.x
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace Orchard.Environment {
|
||||
IHttpContextAccessor httpContextAccessor,
|
||||
ILifetimeScope lifetimeScope) {
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
_lifetimeScope = lifetimeScope;
|
||||
_lifetimeScope = lifetimeScope.Resolve<ILifetimeScope>();
|
||||
}
|
||||
|
||||
public WorkContext GetContext(HttpContextBase httpContext) {
|
||||
|
||||
@@ -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<IHttpContextAccessor>(), ctx.Resolve<ILifetimeScope>()))
|
||||
builder.RegisterType<WorkContextAccessor>()
|
||||
.As<IWorkContextAccessor>()
|
||||
.InstancePerMatchingLifetimeScope("shell");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user