2013-11-07 17:16:22 +01:00
|
|
|
|
using System;
|
2016-10-11 15:57:17 +02:00
|
|
|
|
using Umbraco.Core.Exceptions;
|
2013-11-07 17:16:22 +01:00
|
|
|
|
|
|
|
|
|
|
namespace Umbraco.Core.Models.PublishedContent
|
|
|
|
|
|
{
|
2017-09-26 14:57:50 +02:00
|
|
|
|
/// <inheritdoc />
|
2013-11-07 17:16:22 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Indicates that the class is a published content model for a specified content type.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <remarks>By default, the name of the class is assumed to be the content type alias. The
|
|
|
|
|
|
/// <c>PublishedContentModelAttribute</c> can be used to indicate a different alias.</remarks>
|
|
|
|
|
|
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)]
|
2014-04-21 14:11:55 +02:00
|
|
|
|
public sealed class PublishedContentModelAttribute : Attribute
|
2013-11-07 17:16:22 +01:00
|
|
|
|
{
|
2017-09-26 14:57:50 +02:00
|
|
|
|
/// <inheritdoc />
|
2013-11-07 17:16:22 +01:00
|
|
|
|
/// <summary>
|
2017-09-26 14:57:50 +02:00
|
|
|
|
/// Initializes a new instance of the <see cref="PublishedContentModelAttribute" /> class with a content type alias.
|
2013-11-07 17:16:22 +01:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="contentTypeAlias">The content type alias.</param>
|
|
|
|
|
|
public PublishedContentModelAttribute(string contentTypeAlias)
|
|
|
|
|
|
{
|
2016-10-11 15:57:17 +02:00
|
|
|
|
if (string.IsNullOrWhiteSpace(contentTypeAlias)) throw new ArgumentNullOrEmptyException(nameof(contentTypeAlias));
|
2013-11-07 17:16:22 +01:00
|
|
|
|
ContentTypeAlias = contentTypeAlias;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Gets or sets the content type alias.
|
|
|
|
|
|
/// </summary>
|
2017-09-26 14:57:50 +02:00
|
|
|
|
public string ContentTypeAlias { get; }
|
2013-11-07 17:16:22 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|