Last active
November 10, 2017 10:29
-
-
Save cardinal252/ffe9d2d988e23794fc6bbe1dede72386 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Glass.Mapper.Sc; | |
using Glass.Mapper.Sc.Pipelines.Response; | |
using XXX.Common.IoC; | |
using XXX.Core.Sc.Abstractions.Context; | |
using Sitecore.Mvc.Pipelines.Response.GetModel; | |
namespace XXX.Web | |
{ | |
public class LanguageAgnosticGetModelFromView : GetModelFromView | |
{ | |
protected ISitecoreContextService SitecoreContextService { get; } | |
public LanguageAgnosticGetModelFromView() : this(CompositionRoot.DefaultInstance.Resolve<ISitecoreContextService>()) | |
{ | |
} | |
public LanguageAgnosticGetModelFromView(ISitecoreContextService sitecoreContextService) | |
{ | |
SitecoreContextService = sitecoreContextService; | |
} | |
public override void Process(GetModelArgs args) | |
{ | |
if (SitecoreContextService.IsNormalMode) | |
{ | |
using (new VersionCountDisabler()) | |
{ | |
base.Process(args); | |
} | |
} | |
else | |
{ | |
base.Process(args); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment