Files
Umbraco-CMS/src/Umbraco.Web/PublishedCache/UmbracoContextPublishedSnapshotAccessor.cs
T
2018-04-27 11:38:50 +10:00

30 lines
914 B
C#

using System;
namespace Umbraco.Web.PublishedCache
{
public class UmbracoContextPublishedSnapshotAccessor : IPublishedSnapshotAccessor
{
private readonly IUmbracoContextAccessor _umbracoContextAccessor;
public UmbracoContextPublishedSnapshotAccessor(IUmbracoContextAccessor umbracoContextAccessor)
{
_umbracoContextAccessor = umbracoContextAccessor;
}
public IPublishedSnapshot PublishedSnapshot
{
get
{
var umbracoContext = _umbracoContextAccessor.UmbracoContext;
if (umbracoContext == null) throw new Exception("The IUmbracoContextAccessor could not provide an UmbracoContext.");
return umbracoContext.PublishedSnapshot;
}
set
{
throw new NotSupportedException(); // not ok to set
}
}
}
}