2016-05-30 19:54:36 +02:00
|
|
|
|
using System;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Umbraco.Web.PublishedCache
|
|
|
|
|
|
{
|
2017-10-31 12:48:24 +01:00
|
|
|
|
public class UmbracoContextPublishedSnapshotAccessor : IPublishedSnapshotAccessor
|
2016-05-30 19:54:36 +02:00
|
|
|
|
{
|
|
|
|
|
|
private readonly IUmbracoContextAccessor _umbracoContextAccessor;
|
|
|
|
|
|
|
2017-10-31 12:48:24 +01:00
|
|
|
|
public UmbracoContextPublishedSnapshotAccessor(IUmbracoContextAccessor umbracoContextAccessor)
|
2016-05-30 19:54:36 +02:00
|
|
|
|
{
|
|
|
|
|
|
_umbracoContextAccessor = umbracoContextAccessor;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2018-04-27 11:38:50 +10:00
|
|
|
|
public IPublishedSnapshot PublishedSnapshot
|
2016-05-30 19:54:36 +02:00
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
var umbracoContext = _umbracoContextAccessor.UmbracoContext;
|
2018-05-29 16:42:21 +02:00
|
|
|
|
return umbracoContext?.PublishedSnapshot;
|
2016-05-30 19:54:36 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2018-05-29 16:42:21 +02:00
|
|
|
|
set => throw new NotSupportedException(); // not ok to set
|
2016-05-30 19:54:36 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2017-07-20 11:21:28 +02:00
|
|
|
|
}
|