mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 11:44:58 +08:00
Fixed #5141 Retrieve & Store doesn't support char
This commit is contained in:
@@ -153,7 +153,7 @@ namespace Orchard.ContentManagement {
|
||||
/// <returns>The string representation of the value.</returns>
|
||||
public static string ToString<T>(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 {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user