Files
Umbraco-CMS/src/Umbraco.Core/Models/PublishedContent/PublishedElementWrapped.cs

43 lines
1.4 KiB
C#
Raw Normal View History

2017-07-21 17:04:14 +02:00
using System;
using System.Collections.Generic;
namespace Umbraco.Cms.Core.Models.PublishedContent
2017-07-21 17:04:14 +02:00
{
/// <summary>
2017-09-25 08:59:32 +02:00
/// Provides an abstract base class for <c>IPublishedElement</c> implementations that
/// wrap and extend another <c>IPublishedElement</c>.
2017-07-21 17:04:14 +02:00
/// </summary>
2017-09-25 08:59:32 +02:00
public abstract class PublishedElementWrapped : IPublishedElement
2017-07-21 17:04:14 +02:00
{
2017-09-25 08:59:32 +02:00
private readonly IPublishedElement _content;
2017-07-21 17:04:14 +02:00
/// <summary>
2017-09-25 08:59:32 +02:00
/// Initializes a new instance of the <see cref="PublishedElementWrapped"/> class
/// with an <c>IPublishedElement</c> instance to wrap.
2017-07-21 17:04:14 +02:00
/// </summary>
/// <param name="content">The content to wrap.</param>
2017-09-25 08:59:32 +02:00
protected PublishedElementWrapped(IPublishedElement content)
2017-07-21 17:04:14 +02:00
{
2017-08-24 21:24:14 +02:00
_content = content;
2017-07-21 17:04:14 +02:00
}
/// <summary>
/// Gets the wrapped content.
/// </summary>
/// <returns>The wrapped content, that was passed as an argument to the constructor.</returns>
2017-09-25 08:59:32 +02:00
public IPublishedElement Unwrap() => _content;
2017-07-21 17:04:14 +02:00
/// <inheritdoc />
2019-04-15 13:04:14 +02:00
public IPublishedContentType ContentType => _content.ContentType;
2017-07-21 17:04:14 +02:00
/// <inheritdoc />
2017-08-24 21:24:14 +02:00
public Guid Key => _content.Key;
2017-07-21 17:04:14 +02:00
/// <inheritdoc />
2017-08-24 21:24:14 +02:00
public IEnumerable<IPublishedProperty> Properties => _content.Properties;
2017-07-21 17:04:14 +02:00
/// <inheritdoc />
2017-08-24 21:24:14 +02:00
public IPublishedProperty GetProperty(string alias) => _content.GetProperty(alias);
2017-07-21 17:04:14 +02:00
}
}