Fixes U4-2397 IContent Properties added with incorrect Value when read from Cache, and adds unit test for verifying types saved and returned for 24 standard DataTypes.

This commit is contained in:
Morten Christensen
2013-08-12 16:20:32 +02:00
parent 363de53b82
commit 86811fe507
6 changed files with 124 additions and 22 deletions

View File

@@ -293,7 +293,10 @@ namespace Umbraco.Core.Models
/// <returns><see cref="Property"/> Value as a <see cref="TPassType"/></returns>
public virtual TPassType GetValue<TPassType>(string propertyTypeAlias)
{
return (TPassType)Properties[propertyTypeAlias].Value;
if (Properties[propertyTypeAlias].Value is TPassType)
return (TPassType)Properties[propertyTypeAlias].Value;
return (TPassType)Convert.ChangeType(Properties[propertyTypeAlias].Value, typeof(TPassType));
}
/// <summary>