using System; using System.Runtime.Serialization; namespace Umbraco.Core.Models { /// /// Represents a Template file that can have its content on disk. /// [Serializable] [DataContract(IsReference = true)] public class TemplateOnDisk : Template { /// /// Initializes a new instance of the class. /// /// The name of the template. /// The alias of the template. public TemplateOnDisk(string name, string alias) : base(name, alias) { IsOnDisk = true; } /// /// Gets or sets a value indicating whether the content is on disk already. /// public bool IsOnDisk { get; set; } /// /// Gets or sets the content. /// /// /// Getting the content while the template is "on disk" throws, /// the template must be saved before its content can be retrieved. /// Setting the content means it is not "on disk" anymore, and the /// template becomes (and behaves like) a normal template. /// public override string Content { get { return IsOnDisk ? string.Empty : base.Content; } set { base.Content = value; IsOnDisk = false; } } } }