#18282: Resolving WorkContext the correct way in ShapeTracing

Work Item: 18282

--HG--
branch : 1.x
This commit is contained in:
Sebastien Ros
2011-12-29 16:13:52 -08:00
parent 72e5883fdd
commit 076b73f267
3 changed files with 4 additions and 5 deletions
@@ -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) {
+1 -2
View File
@@ -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");