Skip to content

Commit

Permalink
Fix Sitecore.XA.Foundation.Mvc.Repositories.Base.ModelRepository.Fill…
Browse files Browse the repository at this point in the history
…BaseProperties causes illegal recursion in derived classes
  • Loading branch information
sc-YevhenPovzlo committed Dec 15, 2020
1 parent 164398a commit b72e8b9
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:set="http://www.sitecore.net/xmlconfig/set/" xmlns:role="http://www.sitecore.net/xmlconfig/role/">
<sitecore role:require="Standalone OR ContentManagement OR ContentDelivery OR Processing OR Reporting">
<services>
<register serviceType="Sitecore.XA.Foundation.SitecoreExtensions.Interfaces.IRendering, Sitecore.XA.Foundation.SitecoreExtensions">
<patch:attribute name="implementationType">Sitecore.Support.XA.Foundation.Mvc.Wrappers.Rendering, Sitecore.Support.430451</patch:attribute>
</register>
</services>
</sitecore>
</configuration>
26 changes: 8 additions & 18 deletions src/Sitecore.Support.430451/Rendering.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
namespace Sitecore.XA.Foundation.Mvc.Wrappers
namespace Sitecore.Support.XA.Foundation.Mvc.Wrappers
{
using Microsoft.Extensions.DependencyInjection;
using Sitecore.Data;
using Sitecore.Data.Items;
using Sitecore.DependencyInjection;
using Sitecore.Mvc.Presentation;
using Sitecore.XA.Foundation.Mvc;
using Sitecore.XA.Foundation.Mvc.Wrappers;
Expand All @@ -16,23 +18,11 @@ public class Rendering : IRendering

public RenderingProperties Properties => _sitecoreRendering.Properties;

public Item Item
{
get
{
Item item = DataSourceItem;
if (item == null)
{
RenderingModel obj = _sitecoreRendering.Model as RenderingModel;
if (obj == null)
{
return null;
}
item = obj.PageItem;
}
return item;
}
}
private IPageContext _pageContext;

protected virtual IPageContext PageContext => _pageContext ?? (_pageContext = ServiceProviderServiceExtensions.GetService<IPageContext>(ServiceLocator.ServiceProvider));

public Item Item => DataSourceItem ?? PageContext.Current;

public Item DataSourceItem
{
Expand Down
8 changes: 8 additions & 0 deletions src/Sitecore.Support.430451/Sitecore.Support.430451.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.Extensions.DependencyInjection, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\SC.Microsoft.Extensions.DependencyInjection.9.0.2\lib\Microsoft.Extensions.DependencyInjection.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.Extensions.DependencyInjection.Abstractions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\SC.Microsoft.Extensions.DependencyInjection.Abstractions.9.0.2\lib\Microsoft.Extensions.DependencyInjection.Abstractions.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Sitecore.Kernel">
<HintPath>..\packages\SC.Sitecore.Kernel.9.0.2\lib\Sitecore.Kernel.dll</HintPath>
<Private>False</Private>
Expand Down
2 changes: 2 additions & 0 deletions src/Sitecore.Support.430451/packages.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="SC.Microsoft.Extensions.DependencyInjection" version="9.0.2" targetFramework="net462" />
<package id="SC.Microsoft.Extensions.DependencyInjection.Abstractions" version="9.0.2" targetFramework="net462" />
<package id="SC.Sitecore.Kernel" version="9.0.2" targetFramework="net462" />
<package id="SC.Sitecore.Mvc" version="9.0.2" targetFramework="net462" />
<package id="SXA90.Sitecore.XA.Foundation.Common" version="1.8.0" targetFramework="net462" />
Expand Down

0 comments on commit b72e8b9

Please sign in to comment.