Files
Umbraco-CMS/src/Umbraco.Core/Models/PublishedContent/PropertySetWrapped.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.Core.Models.PublishedContent
{
/// <summary>
/// Provides an abstract base class for <c>IPropertySet</c> implementations that
/// wrap and extend another <c>IPropertySet</c>.
/// </summary>
public abstract class PropertySetWrapped : IPropertySet
{
2017-08-24 21:24:14 +02:00
private readonly IPropertySet _content;
2017-07-21 17:04:14 +02:00
/// <summary>
/// Initializes a new instance of the <see cref="PropertySetWrapped"/> class
/// with an <c>IPropertySet<c> instance to wrap.</c>
/// </summary>
/// <param name="content">The content to wrap.</param>
protected PropertySetWrapped(IPropertySet content)
{
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-08-24 21:24:14 +02:00
public IPropertySet Unwrap() => _content;
2017-07-21 17:04:14 +02:00
/// <inheritdoc />
2017-08-24 21:24:14 +02:00
public PublishedContentType 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
}
}