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

32 lines
1.3 KiB
C#
Raw Normal View History

2013-11-07 17:16:22 +01:00
using System;
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)]
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)
{
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
}
}