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;
|
private int _shapeId;
|
||||||
|
|
||||||
public ShapeTracingFactory(
|
public ShapeTracingFactory(
|
||||||
WorkContext workContext,
|
IWorkContextAccessor workContextAccessor,
|
||||||
IShapeTableManager shapeTableManager,
|
IShapeTableManager shapeTableManager,
|
||||||
IThemeManager themeManager,
|
IThemeManager themeManager,
|
||||||
IWebSiteFolder webSiteFolder,
|
IWebSiteFolder webSiteFolder,
|
||||||
IAuthorizer authorizer
|
IAuthorizer authorizer
|
||||||
) {
|
) {
|
||||||
_workContext = workContext;
|
_workContext = workContextAccessor.GetContext();
|
||||||
_shapeTableManager = shapeTableManager;
|
_shapeTableManager = shapeTableManager;
|
||||||
_themeManager = themeManager;
|
_themeManager = themeManager;
|
||||||
_webSiteFolder = webSiteFolder;
|
_webSiteFolder = webSiteFolder;
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ namespace Orchard.Environment {
|
|||||||
IHttpContextAccessor httpContextAccessor,
|
IHttpContextAccessor httpContextAccessor,
|
||||||
ILifetimeScope lifetimeScope) {
|
ILifetimeScope lifetimeScope) {
|
||||||
_httpContextAccessor = httpContextAccessor;
|
_httpContextAccessor = httpContextAccessor;
|
||||||
_lifetimeScope = lifetimeScope;
|
_lifetimeScope = lifetimeScope.Resolve<ILifetimeScope>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public WorkContext GetContext(HttpContextBase httpContext) {
|
public WorkContext GetContext(HttpContextBase httpContext) {
|
||||||
|
|||||||
@@ -7,13 +7,12 @@ using Autofac;
|
|||||||
using Autofac.Builder;
|
using Autofac.Builder;
|
||||||
using Autofac.Core;
|
using Autofac.Core;
|
||||||
using Autofac.Features.Metadata;
|
using Autofac.Features.Metadata;
|
||||||
using Orchard.Mvc;
|
|
||||||
using Module = Autofac.Module;
|
using Module = Autofac.Module;
|
||||||
|
|
||||||
namespace Orchard.Environment {
|
namespace Orchard.Environment {
|
||||||
public class WorkContextModule : Module {
|
public class WorkContextModule : Module {
|
||||||
protected override void Load(ContainerBuilder builder) {
|
protected override void Load(ContainerBuilder builder) {
|
||||||
builder.Register(ctx => new WorkContextAccessor(ctx.Resolve<IHttpContextAccessor>(), ctx.Resolve<ILifetimeScope>()))
|
builder.RegisterType<WorkContextAccessor>()
|
||||||
.As<IWorkContextAccessor>()
|
.As<IWorkContextAccessor>()
|
||||||
.InstancePerMatchingLifetimeScope("shell");
|
.InstancePerMatchingLifetimeScope("shell");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user