using System;
namespace Umbraco.Core.Models.PublishedContent
{
///
///
/// Indicates that the class is a published content model for a specified content type.
///
/// By default, the name of the class is assumed to be the content type alias. The
/// PublishedContentModelAttribute can be used to indicate a different alias.
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)]
public sealed class PublishedModelAttribute : Attribute
{
///
///
/// Initializes a new instance of the class with a content type alias.
///
/// The content type alias.
public PublishedModelAttribute(string contentTypeAlias)
{
if (contentTypeAlias == null) throw new ArgumentNullException(nameof(contentTypeAlias));
if (string.IsNullOrWhiteSpace(contentTypeAlias)) throw new ArgumentException("Value can't be empty or consist only of white-space characters.", nameof(contentTypeAlias));
ContentTypeAlias = contentTypeAlias;
}
///
/// Gets or sets the content type alias.
///
public string ContentTypeAlias { get; }
}
}