From d805c7773d334443d86b000dfc75c8d7928a490e Mon Sep 17 00:00:00 2001 From: Sergio Navarro Date: Tue, 7 Jul 2015 19:42:06 +0200 Subject: [PATCH] Fixed #5141 Retrieve & Store doesn't support char --- src/Orchard/ContentManagement/XmlHelper.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Orchard/ContentManagement/XmlHelper.cs b/src/Orchard/ContentManagement/XmlHelper.cs index 75f13d462..2e9bfce70 100644 --- a/src/Orchard/ContentManagement/XmlHelper.cs +++ b/src/Orchard/ContentManagement/XmlHelper.cs @@ -153,7 +153,7 @@ namespace Orchard.ContentManagement { /// The string representation of the value. public static string ToString(T value) { var type = typeof(T); - if (type == typeof(string)) { + if (type == typeof(string) || type == typeof(char)) { return Convert.ToString(value); } if ((!type.IsValueType || Nullable.GetUnderlyingType(type) != null) && @@ -250,6 +250,9 @@ namespace Orchard.ContentManagement { if (type == typeof(double)) return (T)(object)double.NegativeInfinity; throw new NotSupportedException(String.Format("Infinity not supported for type {0}", type.Name)); } + if (type == typeof(char) || type == typeof(char?)) { + return (T)(object)char.Parse(value); + } if (type == typeof(int) || type == typeof(int?)) { return (T)(object)int.Parse(value, CultureInfo.InvariantCulture); } @@ -356,4 +359,4 @@ namespace Orchard.ContentManagement { } } } -} \ No newline at end of file +}