Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id D81BC200C4B for ; Mon, 20 Mar 2017 12:27:05 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id D6CBC160B76; Mon, 20 Mar 2017 11:27:05 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 2A291160B92 for ; Mon, 20 Mar 2017 12:27:05 +0100 (CET) Received: (qmail 29640 invoked by uid 500); 20 Mar 2017 11:27:04 -0000 Mailing-List: contact commits-help@ignite.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.apache.org Delivered-To: mailing list commits@ignite.apache.org Received: (qmail 29580 invoked by uid 99); 20 Mar 2017 11:27:04 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 20 Mar 2017 11:27:04 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 13A9BDFFCF; Mon, 20 Mar 2017 11:27:04 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sboikov@apache.org To: commits@ignite.apache.org Date: Mon, 20 Mar 2017 11:27:08 -0000 Message-Id: <87fffb4558e04bc5b0995e4552140a05@git.apache.org> In-Reply-To: <83b227c1a28a4295bbeb8bf56ead03e1@git.apache.org> References: <83b227c1a28a4295bbeb8bf56ead03e1@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [06/10] ignite git commit: .NET: Fix dictionary property handling in plugin configuration archived-at: Mon, 20 Mar 2017 11:27:06 -0000 .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-4680-sb Commit: 47189d2d21e59fe3196e30c0a8c098f01e3ed034 Parents: 9dc64fe Author: Pavel Tupitsyn Authored: Mon Mar 20 12:39:07 2017 +0300 Committer: Pavel Tupitsyn 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 } /// + /// Determines whether specified type is KeyValuePair. + /// + private static bool IsKeyValuePair(Type propertyType) + { + Debug.Assert(propertyType != null); + + return propertyType.IsGenericType && propertyType.GetGenericTypeDefinition() == typeof (KeyValuePair<,>); + } + + /// /// Gets converter for a property. /// private static TypeConverter GetConverter(PropertyInfo property, Type propertyType)