using System.Collections.Generic; namespace Website { public class Content : IContent { protected readonly Dictionary _metaData = new Dictionary(); public int ID { get; set; } public int ParentID { get; set; } public string Title { get; set; } public string Html { get; set; } public string Alias { get; set; } #region Constructors public Content() : this(default(int), default(int), string.Empty, null) { } public Content(int id, string text) : this(id, default(int), text, null) { } public Content(int id, int parentId, string text) : this(id, parentId, text, null) { } public Content(int id, int parentId, string text, Dictionary metaData) { ID = id; ParentID = parentId; Html = text; _metaData = metaData ?? new Dictionary(); } #endregion public T GetMetaData(string key) { return Parse.To(_metaData[key]); } public string this[string key] { get { return _metaData.ContainsKey(key) ? _metaData[key] : string.Empty; } set { _metaData[key] = value; } } } }