Added code comments and serialization attributes.
This commit is contained in:
@@ -1,10 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using System.Runtime.Serialization;
|
||||
using Umbraco.Core.Models.EntityBase;
|
||||
|
||||
namespace Umbraco.Core.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a Dictionary Item
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
[DataContract(IsReference = true)]
|
||||
public class DictionaryItem : Entity
|
||||
{
|
||||
private Guid _parentId;
|
||||
@@ -22,6 +28,10 @@ namespace Umbraco.Core.Models
|
||||
private static readonly PropertyInfo ItemKeySelector = ExpressionHelper.GetPropertyInfo<DictionaryItem, string>(x => x.ItemKey);
|
||||
private static readonly PropertyInfo TranslationsSelector = ExpressionHelper.GetPropertyInfo<DictionaryItem, IEnumerable<DictionaryTranslation>>(x => x.Translations);
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets the Parent Id of the Dictionary Item
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public Guid ParentId
|
||||
{
|
||||
get { return _parentId; }
|
||||
@@ -31,7 +41,11 @@ namespace Umbraco.Core.Models
|
||||
OnPropertyChanged(ParentIdSelector);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Key for the Dictionary Item
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public string ItemKey
|
||||
{
|
||||
get { return _itemKey; }
|
||||
@@ -42,6 +56,10 @@ namespace Umbraco.Core.Models
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a list of translations for the Dictionary Item
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public IEnumerable<DictionaryTranslation> Translations
|
||||
{
|
||||
get { return _translations; }
|
||||
|
||||
@@ -1,9 +1,15 @@
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using System.Runtime.Serialization;
|
||||
using Umbraco.Core.Models.EntityBase;
|
||||
|
||||
namespace Umbraco.Core.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a translation for a <see cref="DictionaryItem"/>
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
[DataContract(IsReference = true)]
|
||||
public class DictionaryTranslation : Entity
|
||||
{
|
||||
private Language _language;
|
||||
@@ -25,6 +31,10 @@ namespace Umbraco.Core.Models
|
||||
private static readonly PropertyInfo LanguageSelector = ExpressionHelper.GetPropertyInfo<DictionaryTranslation, Language>(x => x.Language);
|
||||
private static readonly PropertyInfo ValueSelector = ExpressionHelper.GetPropertyInfo<DictionaryTranslation, string>(x => x.Value);
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the <see cref="Language"/> for the translation
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public Language Language
|
||||
{
|
||||
get { return _language; }
|
||||
@@ -35,6 +45,10 @@ namespace Umbraco.Core.Models
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the translated text
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public string Value
|
||||
{
|
||||
get { return _value; }
|
||||
|
||||
@@ -1,9 +1,16 @@
|
||||
using System.Globalization;
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Reflection;
|
||||
using System.Runtime.Serialization;
|
||||
using Umbraco.Core.Models.EntityBase;
|
||||
|
||||
namespace Umbraco.Core.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a Language
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
[DataContract(IsReference = true)]
|
||||
public class Language : Entity
|
||||
{
|
||||
private string _isoCode;
|
||||
@@ -17,6 +24,10 @@ namespace Umbraco.Core.Models
|
||||
private static readonly PropertyInfo IsoCodeSelector = ExpressionHelper.GetPropertyInfo<Language, string>(x => x.IsoCode);
|
||||
private static readonly PropertyInfo CultureNameSelector = ExpressionHelper.GetPropertyInfo<Language, string>(x => x.CultureName);
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Iso Code for the Language
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public string IsoCode
|
||||
{
|
||||
get { return _isoCode; }
|
||||
@@ -27,6 +38,10 @@ namespace Umbraco.Core.Models
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Culture Name for the Language
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public string CultureName
|
||||
{
|
||||
get { return _cultureName; }
|
||||
@@ -37,6 +52,10 @@ namespace Umbraco.Core.Models
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a <see cref="CultureInfo"/> object for the current Language
|
||||
/// </summary>
|
||||
[IgnoreDataMember]
|
||||
public CultureInfo CultureInfo
|
||||
{
|
||||
get { return CultureInfo.CreateSpecificCulture(IsoCode); }
|
||||
|
||||
Reference in New Issue
Block a user