You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by pt...@apache.org on 2017/03/20 09:39:40 UTC
ignite git commit: .NET: Fix dictionary property handling in plugin
configuration
Repository: ignite
Updated Branches:
refs/heads/ignite-2.0 9dc64fead -> 47189d2d2
.NET: Fix dictionary property handling in plugin configuration
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/47189d2d
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/47189d2d
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/47189d2d
Branch: refs/heads/ignite-2.0
Commit: 47189d2d21e59fe3196e30c0a8c098f01e3ed034
Parents: 9dc64fe
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Mon Mar 20 12:39:07 2017 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Mon Mar 20 12:39:07 2017 +0300
----------------------------------------------------------------------
.../Common/IgniteConfigurationXmlSerializer.cs | 22 +++++++++++++++++---
1 file changed, 19 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/47189d2d/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/IgniteConfigurationXmlSerializer.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/IgniteConfigurationXmlSerializer.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/IgniteConfigurationXmlSerializer.cs
index 8290329..feb0f9e 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/IgniteConfigurationXmlSerializer.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/IgniteConfigurationXmlSerializer.cs
@@ -84,8 +84,14 @@ namespace Apache.Ignite.Core.Impl.Common
private static void WriteElement(object obj, XmlWriter writer, string rootElementName, Type valueType,
PropertyInfo property = null)
{
- if (property != null && (!property.CanWrite || IsObsolete(property)))
- return;
+ if (property != null)
+ {
+ if (!property.CanWrite && !IsKeyValuePair(property.DeclaringType))
+ return;
+
+ if (IsObsolete(property))
+ return;
+ }
if (valueType == typeof(IgniteConfiguration))
writer.WriteStartElement(rootElementName, Schema); // write xmlns for the root element
@@ -416,7 +422,7 @@ namespace Apache.Ignite.Core.Impl.Common
{
Debug.Assert(propertyType != null);
- if (propertyType.IsGenericType && propertyType.GetGenericTypeDefinition() == typeof (KeyValuePair<,>))
+ if (IsKeyValuePair(propertyType))
return false;
return propertyType.IsValueType || propertyType == typeof (string) || propertyType == typeof (Type) ||
@@ -424,6 +430,16 @@ namespace Apache.Ignite.Core.Impl.Common
}
/// <summary>
+ /// Determines whether specified type is KeyValuePair.
+ /// </summary>
+ private static bool IsKeyValuePair(Type propertyType)
+ {
+ Debug.Assert(propertyType != null);
+
+ return propertyType.IsGenericType && propertyType.GetGenericTypeDefinition() == typeof (KeyValuePair<,>);
+ }
+
+ /// <summary>
/// Gets converter for a property.
/// </summary>
private static TypeConverter GetConverter(PropertyInfo property, Type propertyType)