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/04/18 08:20:11 UTC

[1/2] ignite git commit: IGNITE-2398 .NET: Change default name mapper behavior to full name

Repository: ignite
Updated Branches:
  refs/heads/master 99842bf19 -> 3e3b91a8a


http://git-wip-us.apache.org/repos/asf/ignite/blob/3e3b91a8/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySurrogateTypeDescriptor.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySurrogateTypeDescriptor.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySurrogateTypeDescriptor.cs
index cd3becf..737c7c4 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySurrogateTypeDescriptor.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinarySurrogateTypeDescriptor.cs
@@ -1,4 +1,4 @@
-/*
+\ufeff/*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
@@ -62,19 +62,6 @@ namespace Apache.Ignite.Core.Impl.Binary
             _name = typeName;
         }
 
-        /// <summary>
-        /// Constructor.
-        /// </summary>
-        /// <param name="cfg">Configuration.</param>
-        /// <param name="name">Type name.</param>
-        public BinarySurrogateTypeDescriptor(BinaryConfiguration cfg, string name)
-        {
-            _cfg = cfg;
-            _name = name;
-
-            _id = BinaryUtils.TypeId(name, cfg.NameMapper, cfg.IdMapper);
-        }
-
         /** <inheritDoc /> */
         public Type Type
         {

http://git-wip-us.apache.org/repos/asf/ignite/blob/3e3b91a8/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs
index ca2c9ae..0979ea5 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryUtils.cs
@@ -22,9 +22,7 @@ namespace Apache.Ignite.Core.Impl.Binary
     using System.Collections.Generic;
     using System.Diagnostics;
     using System.Diagnostics.CodeAnalysis;
-    using System.Globalization;
     using System.IO;
-    using System.Linq;
     using System.Reflection;
     using System.Runtime.InteropServices;
     using System.Text;
@@ -1638,34 +1636,6 @@ namespace Apache.Ignite.Core.Impl.Binary
         }
 
         /**
-         * <summary>Convert type name.</summary>
-         * <param name="typeName">Type name.</param>
-         * <param name="converter">Converter.</param>
-         * <returns>Converted name.</returns>
-         */
-        public static string ConvertTypeName(string typeName, IBinaryNameMapper converter)
-        {
-            var typeName0 = typeName;
-
-            try
-            {
-                if (converter != null)
-                    typeName = converter.GetTypeName(typeName);
-            }
-            catch (Exception e)
-            {
-                throw new BinaryObjectException("Failed to convert type name due to converter exception " +
-                    "[typeName=" + typeName + ", converter=" + converter + ']', e);
-            }
-
-            if (typeName == null)
-                throw new BinaryObjectException("Name converter returned null name for type [typeName=" +
-                    typeName0 + ", converter=" + converter + "]");
-
-            return typeName;
-        }
-
-        /**
          * <summary>Convert field name.</summary>
          * <param name="fieldName">Field name.</param>
          * <param name="converter">Converter.</param>
@@ -1693,67 +1663,13 @@ namespace Apache.Ignite.Core.Impl.Binary
             return fieldName;
         }
 
-        /**
-         * <summary>Extract simple type name.</summary>
-         * <param name="typeName">Type name.</param>
-         * <returns>Simple type name.</returns>
-         */
-        public static string SimpleTypeName(string typeName)
-        {
-            int idx = typeName.LastIndexOf('.');
-
-            return idx < 0 ? typeName : typeName.Substring(idx + 1);
-        }
-
-        /**
-         * <summary>Resolve type ID.</summary>
-         * <param name="typeName">Type name.</param>
-         * <param name="nameMapper">Name mapper.</param>
-         * <param name="idMapper">ID mapper.</param>
-         */
-        public static int TypeId(string typeName, IBinaryNameMapper nameMapper,
-            IBinaryIdMapper idMapper)
-        {
-            Debug.Assert(typeName != null);
-
-            typeName = ConvertTypeName(typeName, nameMapper);
-
-            int id = 0;
-
-            if (idMapper != null)
-            {
-                try
-                {
-                    id = idMapper.GetTypeId(typeName);
-                }
-                catch (Exception e)
-                {
-                    throw new BinaryObjectException("Failed to resolve type ID due to ID mapper exception " +
-                        "[typeName=" + typeName + ", idMapper=" + idMapper + ']', e);
-                }
-            }
-
-            if (id == 0)
-                id = GetStringHashCode(typeName);
-
-            return id;
-        }
-
         /// <summary>
-        /// Gets the name of the type.
+        /// Gets the SQL name of the type.
         /// </summary>
-        /// <param name="type">The type.</param>
-        /// <returns>
-        /// Simple type name for non-generic types; simple type name with appended generic arguments for generic types.
-        /// </returns>
-        public static string GetTypeName(Type type)
+        public static string GetSqlTypeName(Type type)
         {
-            if (!type.IsGenericType)
-                return type.Name;
-
-            var args = type.GetGenericArguments().Select(GetTypeName).Aggregate((x, y) => x + "," + y);
-
-            return string.Format(CultureInfo.InvariantCulture, "{0}[{1}]", type.Name, args);
+            // SQL always uses simple type name without namespace, parent class, etc.
+            return type.FullName;
         }
 
         /**
@@ -1796,31 +1712,6 @@ namespace Apache.Ignite.Core.Impl.Binary
         }
 
         /// <summary>
-        /// Compare contents of two byte array chunks.
-        /// </summary>
-        /// <param name="arr1">Array 1.</param>
-        /// <param name="offset1">Offset 1.</param>
-        /// <param name="len1">Length 1.</param>
-        /// <param name="arr2">Array 2.</param>
-        /// <param name="offset2">Offset 2.</param>
-        /// <param name="len2">Length 2.</param>
-        /// <returns>True if array chunks are equal.</returns>
-        public static bool CompareArrays(byte[] arr1, int offset1, int len1, byte[] arr2, int offset2, int len2)
-        {
-            if (len1 == len2)
-            {
-                for (int i = 0; i < len1; i++)
-                {
-                    if (arr1[offset1 + i] != arr2[offset2 + i])
-                        return false;
-                }
-
-                return true;
-            }
-            return false;
-        }
-
-        /// <summary>
         /// Writes invocation result.
         /// </summary>
         /// <param name="writer">Writer.</param>

http://git-wip-us.apache.org/repos/asf/ignite/blob/3e3b91a8/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Marshaller.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Marshaller.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Marshaller.cs
index b60ced9..4707ce2 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Marshaller.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Marshaller.cs
@@ -407,7 +407,8 @@ namespace Apache.Ignite.Core.Impl.Binary
 
             return _typeNameToDesc.TryGetValue(typeName, out desc)
                 ? (IBinaryTypeDescriptor) desc
-                : new BinarySurrogateTypeDescriptor(_cfg, typeName);
+                : new BinarySurrogateTypeDescriptor(_cfg,
+                    GetTypeId(typeName, _cfg.IdMapper), typeName);
         }
 
         /// <summary>
@@ -444,7 +445,7 @@ namespace Apache.Ignite.Core.Impl.Binary
                 var type = _ignite == null ? null : _ignite.BinaryProcessor.GetType(typeId);
 
                 if (type != null)
-                    return AddUserType(type, typeId, BinaryUtils.GetTypeName(type), true, desc);
+                    return AddUserType(type, typeId, GetTypeName(type), true, desc);
             }
 
             var meta = GetBinaryType(typeId);
@@ -471,8 +472,8 @@ namespace Apache.Ignite.Core.Impl.Binary
         {
             Debug.Assert(type != null);
 
-            var typeName = BinaryUtils.GetTypeName(type);
-            var typeId = BinaryUtils.TypeId(typeName, _cfg.NameMapper, _cfg.IdMapper);
+            var typeName = GetTypeName(type);
+            var typeId = GetTypeId(typeName, _cfg.IdMapper);
 
             var registered = _ignite != null && _ignite.BinaryProcessor.RegisterType(typeId, type);
 
@@ -538,7 +539,7 @@ namespace Apache.Ignite.Core.Impl.Binary
         private void AddUserType(BinaryConfiguration cfg, BinaryTypeConfiguration typeCfg, TypeResolver typeResolver)
         {
             // Get converter/mapper/serializer.
-            IBinaryNameMapper nameMapper = typeCfg.NameMapper ?? _cfg.NameMapper;
+            IBinaryNameMapper nameMapper = typeCfg.NameMapper ?? _cfg.NameMapper ?? GetDefaultNameMapper();
 
             IBinaryIdMapper idMapper = typeCfg.IdMapper ?? _cfg.IdMapper;
 
@@ -561,8 +562,8 @@ namespace Apache.Ignite.Core.Impl.Binary
                 }
 
                 // Type is found.
-                var typeName = BinaryUtils.GetTypeName(type);
-                int typeId = BinaryUtils.TypeId(typeName, nameMapper, idMapper);
+                var typeName = GetTypeName(type, nameMapper);
+                int typeId = GetTypeId(typeName, idMapper);
                 var affKeyFld = typeCfg.AffinityKeyFieldName ?? GetAffinityKeyFieldNameFromAttribute(type);
                 var serializer = GetSerializer(cfg, typeCfg, type, typeId, nameMapper, idMapper, _log);
 
@@ -572,9 +573,9 @@ namespace Apache.Ignite.Core.Impl.Binary
             else
             {
                 // Type is not found.
-                string typeName = BinaryUtils.SimpleTypeName(typeCfg.TypeName);
+                string typeName = GetTypeName(typeCfg.TypeName, nameMapper);
 
-                int typeId = BinaryUtils.TypeId(typeName, nameMapper, idMapper);
+                int typeId = GetTypeId(typeName, idMapper);
 
                 AddType(null, typeId, typeName, true, keepDeserialized, nameMapper, idMapper, null,
                     typeCfg.AffinityKeyFieldName, typeCfg.IsEnum);
@@ -689,11 +690,15 @@ namespace Apache.Ignite.Core.Impl.Binary
 
             serializer = serializer ?? new BinarySystemTypeSerializer<T>(ctor);
 
+            // System types always use simple name mapper.
+            var typeName = type.Name;
+
             if (typeId == 0)
-                typeId = BinaryUtils.TypeId(type.Name, null, null);
+            {
+                typeId = BinaryUtils.GetStringHashCode(typeName);
+            }
 
-            AddType(type, typeId, BinaryUtils.GetTypeName(type), false, false, null, null, serializer, affKeyFldName,
-                false);
+            AddType(type, typeId, typeName, false, false, null, null, serializer, affKeyFldName, false);
         }
 
         /// <summary>
@@ -756,5 +761,71 @@ namespace Apache.Ignite.Core.Impl.Binary
                     type.AssemblyQualifiedName);
             }
         }
+
+        /// <summary>
+        /// Gets the name of the type.
+        /// </summary>
+        private string GetTypeName(Type type, IBinaryNameMapper mapper = null)
+        {
+            return GetTypeName(type.AssemblyQualifiedName, mapper);
+        }
+
+        /// <summary>
+        /// Gets the name of the type.
+        /// </summary>
+        private string GetTypeName(string fullTypeName, IBinaryNameMapper mapper = null)
+        {
+            mapper = mapper ?? _cfg.NameMapper ?? GetDefaultNameMapper();
+
+            var typeName = mapper.GetTypeName(fullTypeName);
+
+            if (typeName == null)
+            {
+                throw new BinaryObjectException("IBinaryNameMapper returned null name for type [typeName=" +
+                                                fullTypeName + ", mapper=" + mapper + "]");
+            }
+
+            return typeName;
+        }
+
+        /// <summary>
+        /// Resolve type ID.
+        /// </summary>
+        /// <param name="typeName">Type name.</param>
+        /// <param name="idMapper">ID mapper.</param>
+        private static int GetTypeId(string typeName, IBinaryIdMapper idMapper)
+        {
+            Debug.Assert(typeName != null);
+
+            int id = 0;
+
+            if (idMapper != null)
+            {
+                try
+                {
+                    id = idMapper.GetTypeId(typeName);
+                }
+                catch (Exception e)
+                {
+                    throw new BinaryObjectException("Failed to resolve type ID due to ID mapper exception " +
+                                                    "[typeName=" + typeName + ", idMapper=" + idMapper + ']', e);
+                }
+            }
+
+            if (id == 0)
+            {
+                id = BinaryUtils.GetStringHashCode(typeName);
+            }
+
+            return id;
+        }
+
+        /// <summary>
+        /// Gets the default name mapper.
+        /// </summary>
+        private static IBinaryNameMapper GetDefaultNameMapper()
+        {
+            return BinaryBasicNameMapper.FullNameInstance;
+        }
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/3e3b91a8/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/TypeNameParser.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/TypeNameParser.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/TypeNameParser.cs
new file mode 100644
index 0000000..527d47c
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/TypeNameParser.cs
@@ -0,0 +1,384 @@
+\ufeff/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace Apache.Ignite.Core.Impl.Binary
+{
+    using System.Collections.Generic;
+    using Apache.Ignite.Core.Common;
+    using Apache.Ignite.Core.Impl.Common;
+
+    /// <summary>
+    /// Parses .NET-style type names and deconstructs them into parts.
+    /// </summary>
+    internal class TypeNameParser
+    {
+        /** */
+        private readonly int _start;
+
+        /** */
+        private readonly string _typeName;
+
+        /** */
+        private int _pos;
+
+        /// <summary>
+        /// Initializes a new instance of the <see cref="TypeNameParser" /> class.
+        /// </summary>
+        private TypeNameParser(string typeName, ref int pos)
+        {
+            _typeName = typeName;
+            _start = pos;
+            _pos = _start;
+
+            NameEnd = -1;
+            NameStart = 0;
+            AssemblyStart = -1;
+            AssemblyEnd = -1;
+            ArrayStart = -1;
+
+            Parse();
+
+            pos = _pos;
+        }
+
+        /// <summary>
+        /// Parses the specified type name.
+        /// </summary>
+        public static TypeNameParser Parse(string typeName)
+        {
+            IgniteArgumentCheck.NotNullOrEmpty(typeName, "typeName");
+
+            int pos = 0;
+
+            return new TypeNameParser(typeName, ref pos);
+        }
+
+        /// <summary>
+        /// Gets the name start.
+        /// </summary>
+        public int NameStart { get; private set; }
+
+        /// <summary>
+        /// Gets the name end.
+        /// </summary>
+        public int NameEnd { get; private set; }
+
+        /// <summary>
+        /// Gets the start of the assembly name.
+        /// </summary>
+        public int AssemblyStart { get; private set; }
+
+        /// <summary>
+        /// Gets the start of the assembly name.
+        /// </summary>
+        public int AssemblyEnd { get; private set; }
+
+        /// <summary>
+        /// Gets the start of the array definition.
+        /// </summary>
+        public int ArrayStart { get; private set; }
+
+        /// <summary>
+        /// Gets the start of the array definition.
+        /// </summary>
+        public int ArrayEnd { get; private set; }
+
+        /// <summary>
+        /// Gets the generics.
+        /// </summary>
+        public ICollection<TypeNameParser> Generics { get; private set; }
+
+        /// <summary>
+        /// Gets the type name (without namespace).
+        /// </summary>
+        public string GetName()
+        {
+            if (NameEnd < 0)
+                return null;
+
+            return _typeName.Substring(NameStart, NameEnd - NameStart + 1);
+        }
+
+        /// <summary>
+        /// Gets the full type name (with namespace).
+        /// </summary>
+        public string GetFullName()
+        {
+            if (NameEnd < 0)
+                return null;
+
+            return _typeName.Substring(_start, NameEnd - _start + 1);
+        }
+
+        /// <summary>
+        /// Gets the array part.
+        /// </summary>
+        public string GetArray()
+        {
+            if (ArrayStart < 0)
+                return null;
+
+            return _typeName.Substring(ArrayStart, ArrayEnd - ArrayStart + 1);
+        }
+
+        /// <summary>
+        /// Gets assembly name part.
+        /// </summary>
+        public string GetAssemblyName()
+        {
+            if (AssemblyStart < 0)
+                return null;
+
+            return _typeName.Substring(AssemblyStart, AssemblyEnd - AssemblyStart + 1);
+        }
+
+        /// <summary>
+        /// Parses this instance.
+        /// </summary>
+        private void Parse()
+        {
+            // Example:
+            // System.Collections.Generic.List`1[[System.Int32[], mscorlib, Version=4.0.0.0, Culture=neutral,
+            // PublicKeyToken =b77a5c561934e089]][], mscorlib, Version=4.0.0.0, Culture=neutral,
+            // PublicKeyToken =b77a5c561934e089
+
+            // 1) Namespace+name, ends with '`' or '[' or ','
+            // 2) Generic, starts with '`'
+            // 3) Array, starts with '['
+            // 4) Assembly, starts with ',', ends with EOL or `]`
+
+            ParseTypeName();
+            ParseGeneric();
+            ParseArrayDefinition();
+            ParseAssemblyName();
+        }
+
+        /// <summary>
+        /// Parses the type name with namespace.
+        /// </summary>
+        private void ParseTypeName()
+        {
+            NameStart = _pos;
+
+            while (Shift())
+            {
+                if (Char == '.' || Char == '+')
+                {
+                    NameStart = _pos + 1;
+                }
+
+                if (Char == '`')
+                {
+                    // Non-null ist indicates detected generic type.
+                    Generics = Generics ?? new List<TypeNameParser>();
+                }
+
+                if (Char == '[' || Char == ']' || Char == ',' || Char == ' ')
+                    break;
+            }
+
+            NameEnd = End ? _pos : _pos - 1;
+        }
+
+        /// <summary>
+        /// Parses the generic part.
+        /// </summary>
+        private void ParseGeneric()
+        {
+            // Generics can be nested:
+            // UserQuery+Gen`1+Gen2`1[[System.Int32, mscorlib],[System.String, mscorlib]]
+
+            if (Generics == null)
+            {
+                return;
+            }
+
+            if (Char != '[')
+            {
+                throw new IgniteException("Invalid generic type name, number must be followed by '[': " + _typeName);
+            }
+
+            while (true)
+            {
+                RequireShift();
+
+                if (Char != '[')
+                {
+                    throw new IgniteException("Invalid generic type name, '[' must be followed by '[': " + _typeName);
+                }
+
+                RequireShift();
+
+                Generics.Add(new TypeNameParser(_typeName, ref _pos));
+
+                if (Char != ']')
+                {
+                    throw new IgniteException("Invalid generic type name, no matching ']': " + _typeName);
+                }
+
+                RequireShift();
+
+                if (Char == ']')
+                {
+                    Shift();
+                    return;
+                }
+
+                if (Char != ',')
+                {
+                    throw new IgniteException("Invalid generic type name, expected ',': " + _typeName);
+                }
+            }
+        }
+
+        /// <summary>
+        /// Parses the array definition.
+        /// </summary>
+        private void ParseArrayDefinition()
+        {
+            if (Char != '[')
+                return;
+
+            ArrayStart = _pos;
+
+            var bracket = true;
+
+            RequireShift();
+            
+            while (true)
+            {
+                if (Char == '[')
+                {
+                    if (bracket)
+                    {
+                        throw new IgniteException("Invalid array specification: " + _typeName);
+                    }
+
+                    bracket = true;
+                }
+                else if (Char == ']')
+                {
+                    if (!bracket)
+                    {
+                        throw new IgniteException("Invalid array specification: " + _typeName);
+                    }
+
+                    bracket = false;
+                }
+                else if (Char == ',')
+                {
+                    if (!bracket)
+                        break;
+                }
+                else
+                {
+                    if (bracket)
+                    {
+                        throw new IgniteException("Invalid array specification: " + _typeName);
+                    }
+
+                    break;
+                }
+
+                if (!Shift())
+                    break;
+            }
+
+            ArrayEnd = Char == ']' ? _pos : _pos - 1;
+        }
+
+        /// <summary>
+        /// Parses assembly name part.
+        /// </summary>
+        private void ParseAssemblyName()
+        {
+            if (Char != ',')
+                return;
+
+            RequireShift();
+
+            SkipSpaces();
+
+            AssemblyStart = _pos;
+
+            while (Char != ']' && Shift())
+            {
+                // No-op.
+            }
+
+            AssemblyEnd = End ? _pos : _pos - 1;
+        }
+
+        /// <summary>
+        /// Shifts the position forward.
+        /// </summary>
+        private bool Shift()
+        {
+            if (_pos < _typeName.Length - 1)
+            {
+                _pos++;
+                return true;
+            }
+
+            return false;
+        }
+
+        /// <summary>
+        /// Requires position shift or throws an error.
+        /// </summary>
+        private void RequireShift()
+        {
+            if (!Shift())
+            {
+                throw new IgniteException("Invalid type name - not enough data: " + _typeName);
+            }
+        }
+
+        /// <summary>
+        /// Skips the spaces.
+        /// </summary>
+        private void SkipSpaces()
+        {
+            while (Char == ' ' && Shift())
+            {
+                // No-op.
+            }
+        }
+
+        /// <summary>
+        /// Gets a value indicating whether we are at the end of the string.
+        /// </summary>
+        private bool End
+        {
+            get { return _pos >= _typeName.Length - 1; }
+        }
+
+        /// <summary>
+        /// Gets the current character.
+        /// </summary>
+        private char Char
+        {
+            get { return _typeName[_pos]; }
+        }
+
+        /** <inheritdoc /> */
+        public override string ToString()
+        {
+            return _typeName;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/3e3b91a8/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/TypeResolver.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/TypeResolver.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/TypeResolver.cs
index 36dde4b..68222d4 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/TypeResolver.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/TypeResolver.cs
@@ -21,20 +21,14 @@ namespace Apache.Ignite.Core.Impl.Binary
     using System.Collections.Generic;
     using System.Diagnostics;
     using System.Diagnostics.CodeAnalysis;
-    using System.Globalization;
     using System.Linq;
     using System.Reflection;
-    using System.Text.RegularExpressions;
 
     /// <summary>
     /// Resolves types by name.
     /// </summary>
     internal class TypeResolver
     {
-        /** Regex to parse generic types from binary configuration. Allows nested generics in type arguments. */
-        private static readonly Regex GenericTypeRegex =
-            new Regex(@"([^`,\[\]]*)(?:`[0-9]+)?(?:\[((?:(?<br>\[)|(?<-br>\])|[^\[\]]*)+)\])?", RegexOptions.Compiled);
-
         /** Assemblies loaded in ReflectionOnly mode. */
         private readonly Dictionary<string, Assembly> _reflectionOnlyAssemblies = new Dictionary<string, Assembly>();
 
@@ -54,11 +48,15 @@ namespace Apache.Ignite.Core.Impl.Binary
             var type = Type.GetType(typeName, false);
 
             if (type != null)
+            {
                 return type;
+            }
+
+            var parsedType = TypeNameParser.Parse(typeName);
 
             // Partial names should be resolved by scanning assemblies.
-            return ResolveType(assemblyName, typeName, AppDomain.CurrentDomain.GetAssemblies())
-                ?? ResolveTypeInReferencedAssemblies(assemblyName, typeName);
+            return ResolveType(assemblyName, parsedType, AppDomain.CurrentDomain.GetAssemblies())
+                ?? ResolveTypeInReferencedAssemblies(assemblyName, parsedType);
         }
 
         /// <summary>
@@ -70,10 +68,23 @@ namespace Apache.Ignite.Core.Impl.Binary
         /// <returns> 
         /// Resolved type. 
         /// </returns>
-        private static Type ResolveType(string assemblyName, string typeName, ICollection<Assembly> assemblies)
+        private static Type ResolveType(string assemblyName, TypeNameParser typeName, ICollection<Assembly> assemblies)
         {
-            return ResolveGenericType(assemblyName, typeName, assemblies) ??
-                   ResolveNonGenericType(assemblyName, typeName, assemblies);
+            var type = ResolveNonGenericType(assemblyName, typeName.GetFullName(), assemblies);
+
+            if (type == null)
+            {
+                return null;
+            }
+
+            if (type.IsGenericTypeDefinition && typeName.Generics != null)
+            {
+                var genArgs = typeName.Generics.Select(x => ResolveType(assemblyName, x, assemblies)).ToArray();
+
+                return type.MakeGenericType(genArgs);
+            }
+
+            return type;
         }
 
         /// <summary>
@@ -85,64 +96,34 @@ namespace Apache.Ignite.Core.Impl.Binary
         /// <returns>Resolved type, or null.</returns>
         private static Type ResolveNonGenericType(string assemblyName, string typeName, ICollection<Assembly> assemblies)
         {
+            // Fully-qualified name can be resolved with system mechanism.
+            var type = Type.GetType(typeName, false);
+
+            if (type != null)
+            {
+                return type;
+            }
+
             if (!string.IsNullOrEmpty(assemblyName))
+            {
                 assemblies = assemblies
                     .Where(x => x.FullName == assemblyName || x.GetName().Name == assemblyName).ToArray();
+            }
 
             if (!assemblies.Any())
+            {
                 return null;
+            }
 
             // Trim assembly qualification
             var commaIdx = typeName.IndexOf(',');
 
             if (commaIdx > 0)
+            {
                 typeName = typeName.Substring(0, commaIdx);
+            }
 
-            return assemblies.Select(a => a.GetType(typeName, false, false)).FirstOrDefault(type => type != null);
-        }
-
-        /// <summary>
-        /// Resolves the name of the generic type by resolving each generic arg separately 
-        /// and substituting it's fully qualified name.
-        /// (Assembly.GetType finds generic types only when arguments are fully qualified).
-        /// </summary>
-        /// <param name="assemblyName">Name of the assembly.</param>
-        /// <param name="typeName">Name of the type.</param>
-        /// <param name="assemblies">Assemblies</param>
-        /// <returns>Fully qualified generic type name, or null if argument(s) could not be resolved.</returns>
-        private static Type ResolveGenericType(string assemblyName, string typeName, ICollection<Assembly> assemblies)
-        {
-            var match = GenericTypeRegex.Match(typeName);
-
-            if (!match.Success || !match.Groups[2].Success)
-                return null;
-
-            // Try to construct generic type; each generic arg can also be a generic type.
-            var genericArgs = GenericTypeRegex.Matches(match.Groups[2].Value)
-                .OfType<Match>().Select(m => m.Value).Where(v => !string.IsNullOrWhiteSpace(v))
-                .Select(v => ResolveType(null, TrimBrackets(v), assemblies)).ToArray();
-
-            if (genericArgs.Any(x => x == null))
-                return null;
-
-            var genericType = ResolveNonGenericType(assemblyName,
-                string.Format(CultureInfo.InvariantCulture, "{0}`{1}", match.Groups[1].Value, genericArgs.Length),
-                assemblies);
-
-            if (genericType == null)
-                return null;
-
-            return genericType.MakeGenericType(genericArgs);
-        }
-
-        /// <summary>
-        /// Trims the brackets from generic type arg.
-        /// </summary>
-        private static string TrimBrackets(string s)
-        {
-            return s.StartsWith("[", StringComparison.Ordinal) && s.EndsWith("]", StringComparison.Ordinal) 
-                ? s.Substring(1, s.Length - 2) 
-                : s;
+            return assemblies.Select(a => a.GetType(typeName, false, false)).FirstOrDefault(x => x != null);
         }
 
         /// <summary>
@@ -153,7 +134,7 @@ namespace Apache.Ignite.Core.Impl.Binary
         /// <returns>
         /// Resolved type.
         /// </returns>
-        private Type ResolveTypeInReferencedAssemblies(string assemblyName, string typeName)
+        private Type ResolveTypeInReferencedAssemblies(string assemblyName, TypeNameParser typeName)
         {
             ResolveEventHandler resolver = (sender, args) => GetReflectionOnlyAssembly(args.Name);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/3e3b91a8/modules/platforms/dotnet/Apache.Ignite.Linq/Impl/CacheFieldsQueryProvider.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Linq/Impl/CacheFieldsQueryProvider.cs b/modules/platforms/dotnet/Apache.Ignite.Linq/Impl/CacheFieldsQueryProvider.cs
index e909575..c665fe7 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Linq/Impl/CacheFieldsQueryProvider.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Linq/Impl/CacheFieldsQueryProvider.cs
@@ -168,7 +168,7 @@ namespace Apache.Ignite.Linq.Impl
         /// </summary>
         private void ValidateTableName()
         {
-            var validTableNames = GetValidTableNames();
+            var validTableNames = GetValidTableNames().Select(x => EscapeTableName(x)).ToArray();
 
             if (!validTableNames.Contains(_tableName, StringComparer.OrdinalIgnoreCase))
             {
@@ -201,7 +201,7 @@ namespace Apache.Ignite.Linq.Impl
         /// </summary>
         private static string GetTableName(QueryEntity e)
         {
-            return e.TableName ?? e.ValueTypeName.Split('.').Last();
+            return e.TableName ?? e.ValueTypeName;
         }
 
         /// <summary>
@@ -213,12 +213,16 @@ namespace Apache.Ignite.Linq.Impl
             var validTableNames = GetValidTableNames();
 
             if (validTableNames.Length == 1)
-                return validTableNames[0];
+            {
+                return EscapeTableName(validTableNames[0]);
+            }
 
-            var valueTypeName = cacheValueType.Name;
+            var valueTypeName = cacheValueType.FullName;
 
             if (validTableNames.Contains(valueTypeName, StringComparer.OrdinalIgnoreCase))
-                return valueTypeName;
+            {
+                return EscapeTableName(valueTypeName);
+            }
 
             throw new CacheException(string.Format("Table name cannot be inferred for cache '{0}', " +
                                                    "please use AsCacheQueryable overload with tableName parameter. " +
@@ -227,6 +231,16 @@ namespace Apache.Ignite.Linq.Impl
         }
 
         /// <summary>
+        /// Escapes the name of the table: strips namespace and nested class qualifiers.
+        /// </summary>
+        private static string EscapeTableName(string valueTypeName)
+        {
+            var nsIndex = Math.Max(valueTypeName.LastIndexOf('.'), valueTypeName.LastIndexOf('+'));
+
+            return nsIndex > 0 ? valueTypeName.Substring(nsIndex + 1) : valueTypeName;
+        }
+
+        /// <summary>
         /// Gets the item type of closed generic i enumerable.
         /// </summary>
         private static Type GetItemTypeOfClosedGenericIEnumerable(Type enumerableType, string argumentName)

http://git-wip-us.apache.org/repos/asf/ignite/blob/3e3b91a8/modules/platforms/dotnet/Apache.Ignite.Linq/Impl/CacheQueryExpressionVisitor.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Linq/Impl/CacheQueryExpressionVisitor.cs b/modules/platforms/dotnet/Apache.Ignite.Linq/Impl/CacheQueryExpressionVisitor.cs
index 99712e3..3659158 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Linq/Impl/CacheQueryExpressionVisitor.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Linq/Impl/CacheQueryExpressionVisitor.cs
@@ -338,8 +338,8 @@ namespace Apache.Ignite.Linq.Impl
 
             var entity = cacheCfg.QueryEntities.FirstOrDefault(e =>
                 e.Aliases != null &&
-                (e.KeyType == keyValTypes[0] || e.KeyTypeName == keyValTypes[0].Name) &&
-                (e.ValueType == keyValTypes[1] || e.ValueTypeName == keyValTypes[1].Name));
+                (e.KeyType == keyValTypes[0] || e.KeyTypeName == keyValTypes[0].FullName) &&
+                (e.ValueType == keyValTypes[1] || e.ValueTypeName == keyValTypes[1].FullName));
 
             if (entity == null)
                 return fieldName;


[2/2] ignite git commit: IGNITE-2398 .NET: Change default name mapper behavior to full name

Posted by pt...@apache.org.
IGNITE-2398 .NET: Change default name mapper behavior to full name

This closes #1787


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/3e3b91a8
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/3e3b91a8
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/3e3b91a8

Branch: refs/heads/master
Commit: 3e3b91a8a3e50ce8e255bb0ce2bfc4ae9ab858a2
Parents: 99842bf
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Tue Apr 18 11:19:57 2017 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Tue Apr 18 11:19:57 2017 +0300

----------------------------------------------------------------------
 .../ignite/binary/BinaryBasicNameMapper.java    |   3 +
 .../PlatformDotNetConfigurationClosure.java     |  66 +---
 .../utils/PlatformConfigurationUtils.java       |   8 +
 .../internal/processors/query/QueryUtils.java   |   5 +
 .../Apache.Ignite.Core.Tests.csproj             |   7 +
 .../Binary/BinaryBuilderSelfTest.cs             |  90 +++--
 .../Binary/BinaryBuilderSelfTestSimpleName.cs   |  33 ++
 .../Binary/BinaryCompactFooterInteropTest.cs    |   3 +
 .../Binary/BinaryDynamicRegistrationTest.cs     |  10 +-
 .../Binary/BinaryNameMapperTest.cs              | 108 ++++++
 .../Binary/BinarySelfTest.cs                    |  20 +-
 .../Binary/BinarySelfTestSimpleName.cs          |  33 ++
 .../Binary/Serializable/SqlDmlTest.cs           |   3 +
 .../Binary/TypeNameParserTest.cs                | 232 +++++++++++
 .../Cache/Query/CacheDmlQueriesTest.cs          |  11 +
 .../Query/CacheDmlQueriesTestSimpleName.cs      |  35 ++
 .../Cache/Query/CacheLinqTest.cs                |  15 +-
 .../Cache/Query/CacheLinqTestSimpleName.cs      |  35 ++
 .../Query/CacheQueriesCodeConfigurationTest.cs  |  10 +-
 .../Cache/Query/CacheQueriesTest.cs             |  13 +-
 .../Cache/Query/CacheQueriesTestSimpleName.cs   |  35 ++
 .../Continuous/ContinuousQueryAbstractTest.cs   |  36 +-
 .../Cache/Store/CacheStoreTest.cs               |   4 +-
 .../Compute/ComputeApiTest.cs                   |   3 +-
 .../Config/Compute/compute-grid2.xml            |  10 -
 .../Config/cache-binarizables.xml               |  16 +-
 .../Config/cache-query-continuous.xml           |   8 +-
 .../Config/cache-query.xml                      |   2 +-
 .../Services/ServicesTest.cs                    |   3 +
 .../Apache.Ignite.Core.csproj                   |   2 +
 .../Binary/BinaryBasicNameMapper.cs             | 129 +++++++
 .../Cache/Configuration/QueryEntity.cs          |   4 +-
 .../Cache/Configuration/QueryField.cs           |   2 +-
 .../Apache.Ignite.Core/IgniteConfiguration.cs   |  11 +
 .../Apache.Ignite.Core/Impl/Binary/Binary.cs    |  10 +-
 .../Binary/BinarySurrogateTypeDescriptor.cs     |  15 +-
 .../Impl/Binary/BinaryUtils.cs                  | 117 +-----
 .../Impl/Binary/Marshaller.cs                   |  95 ++++-
 .../Impl/Binary/TypeNameParser.cs               | 384 +++++++++++++++++++
 .../Impl/Binary/TypeResolver.cs                 |  95 ++---
 .../Impl/CacheFieldsQueryProvider.cs            |  24 +-
 .../Impl/CacheQueryExpressionVisitor.cs         |   4 +-
 42 files changed, 1403 insertions(+), 346 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/3e3b91a8/modules/core/src/main/java/org/apache/ignite/binary/BinaryBasicNameMapper.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/binary/BinaryBasicNameMapper.java b/modules/core/src/main/java/org/apache/ignite/binary/BinaryBasicNameMapper.java
index bc338b4..156716c 100644
--- a/modules/core/src/main/java/org/apache/ignite/binary/BinaryBasicNameMapper.java
+++ b/modules/core/src/main/java/org/apache/ignite/binary/BinaryBasicNameMapper.java
@@ -111,6 +111,9 @@ public class BinaryBasicNameMapper implements BinaryNameMapper {
         }
 
         if (idx < 0)
+            idx = clsName.lastIndexOf('+');   // .NET inner class.
+
+        if (idx < 0)
             idx = clsName.lastIndexOf('.');
 
         return idx >= 0 ? clsName.substring(idx + 1) : clsName;

http://git-wip-us.apache.org/repos/asf/ignite/blob/3e3b91a8/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetConfigurationClosure.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetConfigurationClosure.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetConfigurationClosure.java
index 0ff78af..b0daf35 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetConfigurationClosure.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/dotnet/PlatformDotNetConfigurationClosure.java
@@ -101,13 +101,33 @@ public class PlatformDotNetConfigurationClosure extends PlatformAbstractConfigur
 
         igniteCfg.setPlatformConfiguration(dotNetCfg0);
 
+        // Set Ignite home so that marshaller context works.
+        String ggHome = igniteCfg.getIgniteHome();
+
+        if (ggHome != null)
+            U.setIgniteHome(ggHome);
+
+        // 4. Callback to .Net.
+        prepare(igniteCfg, dotNetCfg0);
+
+        // Make sure binary config is right.
+        setBinaryConfiguration(igniteCfg, dotNetCfg0);
+    }
+
+    /**
+     * Sets binary config.
+     *
+     * @param igniteCfg Ignite config.
+     * @param dotNetCfg Dotnet config.
+     */
+    private void setBinaryConfiguration(IgniteConfiguration igniteCfg, PlatformDotNetConfigurationEx dotNetCfg) {
         // Check marshaller.
         Marshaller marsh = igniteCfg.getMarshaller();
 
         if (marsh == null) {
             igniteCfg.setMarshaller(new BinaryMarshaller());
 
-            dotNetCfg0.warnings(Collections.singleton("Marshaller is automatically set to " +
+            dotNetCfg.warnings(Collections.singleton("Marshaller is automatically set to " +
                 BinaryMarshaller.class.getName() + " (other nodes must have the same marshaller type)."));
         }
         else if (!(marsh instanceof BinaryMarshaller))
@@ -115,50 +135,6 @@ public class PlatformDotNetConfigurationClosure extends PlatformAbstractConfigur
                 " can be used when running Apache Ignite.NET): " + marsh.getClass().getName());
 
         BinaryConfiguration bCfg = igniteCfg.getBinaryConfiguration();
-
-        if (bCfg == null) {
-            bCfg = new BinaryConfiguration();
-
-            bCfg.setNameMapper(new BinaryBasicNameMapper(true));
-            bCfg.setIdMapper(new BinaryBasicIdMapper(true));
-
-            igniteCfg.setBinaryConfiguration(bCfg);
-
-            dotNetCfg0.warnings(Collections.singleton("Binary configuration is automatically initiated, " +
-                "note that binary name mapper is set to " + bCfg.getNameMapper()
-                + " and binary ID mapper is set to " + bCfg.getIdMapper()
-                + " (other nodes must have the same binary name and ID mapper types)."));
-        }
-        else {
-            BinaryNameMapper nameMapper = bCfg.getNameMapper();
-
-            if (nameMapper == null) {
-                bCfg.setNameMapper(new BinaryBasicNameMapper(true));
-
-                dotNetCfg0.warnings(Collections.singleton("Binary name mapper is automatically set to " +
-                    bCfg.getNameMapper()
-                    + " (other nodes must have the same binary name mapper type)."));
-            }
-
-            BinaryIdMapper idMapper = bCfg.getIdMapper();
-
-            if (idMapper == null) {
-                bCfg.setIdMapper(new BinaryBasicIdMapper(true));
-
-                dotNetCfg0.warnings(Collections.singleton("Binary ID mapper is automatically set to " +
-                    bCfg.getIdMapper()
-                    + " (other nodes must have the same binary ID mapper type)."));
-            }
-        }
-
-        // Set Ignite home so that marshaller context works.
-        String ggHome = igniteCfg.getIgniteHome();
-
-        if (ggHome != null)
-            U.setIgniteHome(ggHome);
-
-        // 4. Callback to .Net.
-        prepare(igniteCfg, dotNetCfg0);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/3e3b91a8/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java
index 6a15b85..98ce61d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java
@@ -34,6 +34,7 @@ import java.util.Set;
 import javax.cache.configuration.Factory;
 import javax.cache.expiry.ExpiryPolicy;
 import org.apache.ignite.IgniteException;
+import org.apache.ignite.binary.BinaryBasicNameMapper;
 import org.apache.ignite.binary.BinaryRawReader;
 import org.apache.ignite.binary.BinaryRawWriter;
 import org.apache.ignite.cache.CacheAtomicityMode;
@@ -563,6 +564,11 @@ public class PlatformConfigurationUtils {
 
             if (in.readBoolean())  // compact footer is set
                 cfg.getBinaryConfiguration().setCompactFooter(in.readBoolean());
+
+            if (in.readBoolean()) {
+                // Simple name mapper.
+                cfg.getBinaryConfiguration().setNameMapper(new BinaryBasicNameMapper(true));
+            }
         }
 
         int attrCnt = in.readInt();
@@ -969,6 +975,8 @@ public class PlatformConfigurationUtils {
             w.writeBoolean(true);  // binary config exists
             w.writeBoolean(true);  // compact footer is set
             w.writeBoolean(bc.isCompactFooter());
+            w.writeBoolean(bc.getNameMapper() instanceof BinaryBasicNameMapper &&
+                    ((BinaryBasicNameMapper)(bc.getNameMapper())).isSimpleName());
         }
         else
             w.writeBoolean(false);

http://git-wip-us.apache.org/repos/asf/ignite/blob/3e3b91a8/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryUtils.java
index 118f8b8..f00cbd6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/QueryUtils.java
@@ -615,6 +615,11 @@ public class QueryUtils {
         if (parentEnd >= 0)
             clsName = clsName.substring(parentEnd + 1);
 
+        parentEnd = clsName.lastIndexOf('+');   // .NET parent
+
+        if (parentEnd >= 0)
+            clsName = clsName.substring(parentEnd + 1);
+
         return clsName;
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/3e3b91a8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
index 838a1e0..a13878a 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
@@ -68,9 +68,12 @@
     <Reference Include="System.Xml.Linq" />
   </ItemGroup>
   <ItemGroup>
+    <Compile Include="Binary\BinaryBuilderSelfTestSimpleName.cs" />
     <Compile Include="Binary\BinaryEqualityComparerTest.cs" />
     <Compile Include="Binary\BinaryBuilderSelfTestDynamicRegistration.cs" />
+    <Compile Include="Binary\BinaryNameMapperTest.cs" />
     <Compile Include="Binary\BinaryReaderWriterTest.cs" />
+    <Compile Include="Binary\BinarySelfTestSimpleName.cs" />
     <Compile Include="Binary\IO\BinaryStreamsTest.cs" />
     <Compile Include="Binary\JavaBinaryInteropTest.cs" />
     <Compile Include="Binary\JavaTypeMappingTest.cs" />
@@ -80,6 +83,7 @@
     <Compile Include="Binary\Serializable\ObjectReferenceTests.cs" />
     <Compile Include="Binary\Serializable\PrimitivesTest.cs" />
     <Compile Include="Binary\Serializable\SqlDmlTest.cs" />
+    <Compile Include="Binary\TypeNameParserTest.cs" />
     <Compile Include="Binary\TypeResolverTest.cs" />
     <Compile Include="Cache\Affinity\AffinityKeyTest.cs" />
     <Compile Include="Cache\Affinity\AffinityTopologyVersionTest.cs" />
@@ -87,6 +91,9 @@
     <Compile Include="Cache\CacheResultTest.cs" />
     <Compile Include="Cache\Query\CacheDmlQueriesTest.cs" />
     <Compile Include="Cache\CacheAbstractTransactionalTest.cs" />
+    <Compile Include="Cache\Query\CacheDmlQueriesTestSimpleName.cs" />
+    <Compile Include="Cache\Query\CacheLinqTestSimpleName.cs" />
+    <Compile Include="Cache\Query\CacheQueriesTestSimpleName.cs" />
     <Compile Include="Cache\Store\CacheStoreAdapterTest.cs" />
     <Compile Include="Cache\Store\NamedNodeCacheStoreTest.cs" />
     <Compile Include="Collections\MultiValueDictionaryTest.cs" />

http://git-wip-us.apache.org/repos/asf/ignite/blob/3e3b91a8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryBuilderSelfTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryBuilderSelfTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryBuilderSelfTest.cs
index c104e15..e8d0049 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryBuilderSelfTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryBuilderSelfTest.cs
@@ -58,8 +58,8 @@ namespace Apache.Ignite.Core.Tests.Binary
                 {
                     TypeConfigurations = GetTypeConfigurations(),
                     IdMapper = new IdMapper(),
-                    NameMapper = new NameMapper(),
-                    CompactFooter = GetCompactFooter()
+                    NameMapper = new NameMapper(GetNameMapper()),
+                    CompactFooter = GetCompactFooter(),
                 }
             };
 
@@ -114,6 +114,22 @@ namespace Apache.Ignite.Core.Tests.Binary
         }
 
         /// <summary>
+        /// Gets the name mapper.
+        /// </summary>
+        protected virtual IBinaryNameMapper GetNameMapper()
+        {
+            return BinaryBasicNameMapper.FullNameInstance;
+        }
+
+        /// <summary>
+        /// Gets the name of the type.
+        /// </summary>
+        private string GetTypeName(Type type)
+        {
+            return GetNameMapper().GetTypeName(type.AssemblyQualifiedName);
+        }
+
+        /// <summary>
         /// Tear down routine.
         /// </summary>
         [TestFixtureTearDown]
@@ -249,7 +265,7 @@ namespace Apache.Ignite.Core.Tests.Binary
             // 4. Objects.
             IBinaryObject binObj = api.ToBinary<IBinaryObject>(new ToBinary(1));
 
-            Assert.AreEqual(typeof(ToBinary).Name, binObj.GetBinaryType().TypeName);
+            Assert.AreEqual(GetTypeName(typeof(ToBinary)), binObj.GetBinaryType().TypeName);
             Assert.AreEqual(1, binObj.GetBinaryType().Fields.Count);
             Assert.AreEqual("Val", binObj.GetBinaryType().Fields.First());
             Assert.AreEqual(BinaryTypeNames.TypeNameInt, binObj.GetBinaryType().GetFieldTypeName("Val"));
@@ -280,7 +296,7 @@ namespace Apache.Ignite.Core.Tests.Binary
 
             IBinaryType meta = binObj.GetBinaryType();
 
-            Assert.AreEqual(typeof(Remove).Name, meta.TypeName);
+            Assert.AreEqual(GetTypeName(typeof(Remove)), meta.TypeName);
             Assert.AreEqual(0, meta.Fields.Count);
 
             // Populate it with field.
@@ -301,7 +317,7 @@ namespace Apache.Ignite.Core.Tests.Binary
 
             meta = binObj.GetBinaryType();
 
-            Assert.AreEqual(typeof(Remove).Name, meta.TypeName);
+            Assert.AreEqual(GetTypeName(typeof(Remove)), meta.TypeName);
             Assert.AreEqual(1, meta.Fields.Count);
             Assert.AreEqual("val", meta.Fields.First());
             Assert.AreEqual(BinaryTypeNames.TypeNameObject, meta.GetFieldTypeName("val"));
@@ -358,7 +374,7 @@ namespace Apache.Ignite.Core.Tests.Binary
 
             IBinaryType meta = outerbinObj.GetBinaryType();
 
-            Assert.AreEqual(typeof(BuilderInBuilderOuter).Name, meta.TypeName);
+            Assert.AreEqual(GetTypeName(typeof(BuilderInBuilderOuter)), meta.TypeName);
             Assert.AreEqual(1, meta.Fields.Count);
             Assert.AreEqual("inner", meta.Fields.First());
             Assert.AreEqual(BinaryTypeNames.TypeNameObject, meta.GetFieldTypeName("inner"));
@@ -367,7 +383,7 @@ namespace Apache.Ignite.Core.Tests.Binary
 
             meta = innerbinObj.GetBinaryType();
 
-            Assert.AreEqual(typeof(BuilderInBuilderInner).Name, meta.TypeName);
+            Assert.AreEqual(GetTypeName(typeof(BuilderInBuilderInner)), meta.TypeName);
             Assert.AreEqual(1, meta.Fields.Count);
             Assert.AreEqual("outer", meta.Fields.First());
             Assert.AreEqual(BinaryTypeNames.TypeNameObject, meta.GetFieldTypeName("outer"));
@@ -386,7 +402,7 @@ namespace Apache.Ignite.Core.Tests.Binary
 
             meta = outerbinObj.GetBinaryType();
 
-            Assert.AreEqual(typeof(BuilderInBuilderOuter).Name, meta.TypeName);
+            Assert.AreEqual(GetTypeName(typeof(BuilderInBuilderOuter)), meta.TypeName);
             Assert.AreEqual(2, meta.Fields.Count);
             Assert.IsTrue(meta.Fields.Contains("inner"));
             Assert.IsTrue(meta.Fields.Contains("inner2"));
@@ -423,7 +439,7 @@ namespace Apache.Ignite.Core.Tests.Binary
 
             IBinaryType meta = binObj.GetBinaryType();
 
-            Assert.AreEqual(typeof(DecimalHolder).Name, meta.TypeName);
+            Assert.AreEqual(GetTypeName(typeof(DecimalHolder)), meta.TypeName);
             Assert.AreEqual(2, meta.Fields.Count);
             Assert.IsTrue(meta.Fields.Contains("val"));
             Assert.IsTrue(meta.Fields.Contains("valArr"));
@@ -456,7 +472,7 @@ namespace Apache.Ignite.Core.Tests.Binary
 
             IBinaryType meta = binCol.GetBinaryType();
 
-            Assert.AreEqual(typeof(BuilderCollection).Name, meta.TypeName);
+            Assert.AreEqual(GetTypeName(typeof(BuilderCollection)), meta.TypeName);
             Assert.AreEqual(1, meta.Fields.Count);
             Assert.AreEqual("col", meta.Fields.First());
             Assert.AreEqual(BinaryTypeNames.TypeNameCollection, meta.GetFieldTypeName("col"));
@@ -469,7 +485,7 @@ namespace Apache.Ignite.Core.Tests.Binary
 
             meta = binItem.GetBinaryType();
 
-            Assert.AreEqual(typeof(BuilderCollectionItem).Name, meta.TypeName);
+            Assert.AreEqual(GetTypeName(typeof(BuilderCollectionItem)), meta.TypeName);
             Assert.AreEqual(1, meta.Fields.Count);
             Assert.AreEqual("val", meta.Fields.First());
             Assert.AreEqual(BinaryTypeNames.TypeNameInt, meta.GetFieldTypeName("val"));
@@ -549,7 +565,7 @@ namespace Apache.Ignite.Core.Tests.Binary
             IBinaryType meta = binObj.GetBinaryType();
 
             Assert.IsNotNull(meta);
-            Assert.AreEqual(typeof(Empty).Name, meta.TypeName);
+            Assert.AreEqual(GetTypeName(typeof(Empty)), meta.TypeName);
             Assert.AreEqual(0, meta.Fields.Count);
 
             Empty obj = binObj.Deserialize<Empty>();
@@ -690,11 +706,11 @@ namespace Apache.Ignite.Core.Tests.Binary
         /// <summary>
         /// Checks the primitive fields values.
         /// </summary>
-        private static void CheckPrimitiveFields1(IBinaryObject binObj)
+        private void CheckPrimitiveFields1(IBinaryObject binObj)
         {
             IBinaryType meta = binObj.GetBinaryType();
 
-            Assert.AreEqual(typeof(Primitives).Name, meta.TypeName);
+            Assert.AreEqual(GetTypeName(typeof(Primitives)), meta.TypeName);
 
             Assert.AreEqual(9, meta.Fields.Count);
 
@@ -842,11 +858,11 @@ namespace Apache.Ignite.Core.Tests.Binary
         /// <summary>
         /// Checks the primitive array fields.
         /// </summary>
-        private static void CheckPrimitiveArrayFields1(IBinaryObject binObj)
+        private void CheckPrimitiveArrayFields1(IBinaryObject binObj)
         {
             IBinaryType meta = binObj.GetBinaryType();
 
-            Assert.AreEqual(typeof(PrimitiveArrays).Name, meta.TypeName);
+            Assert.AreEqual(GetTypeName(typeof(PrimitiveArrays)), meta.TypeName);
 
             Assert.AreEqual(9, meta.Fields.Count);
 
@@ -1009,7 +1025,7 @@ namespace Apache.Ignite.Core.Tests.Binary
         {
             IBinaryType meta = binObj.GetBinaryType();
 
-            Assert.AreEqual(typeof(StringDateGuidEnum).Name, meta.TypeName);
+            Assert.AreEqual(GetTypeName(typeof(StringDateGuidEnum)), meta.TypeName);
 
             Assert.AreEqual(10, meta.Fields.Count);
 
@@ -1139,7 +1155,7 @@ namespace Apache.Ignite.Core.Tests.Binary
             var meta = binEnum.GetBinaryType();
 
             Assert.IsTrue(meta.IsEnum);
-            Assert.AreEqual(typeof (TestEnumRegistered).Name, meta.TypeName);
+            Assert.AreEqual(GetTypeName(typeof (TestEnumRegistered)), meta.TypeName);
             Assert.AreEqual(0, meta.Fields.Count);
         }
 
@@ -1157,7 +1173,7 @@ namespace Apache.Ignite.Core.Tests.Binary
 
             IBinaryType meta = binObj.GetBinaryType();
 
-            Assert.AreEqual(typeof(CompositeArray).Name, meta.TypeName);
+            Assert.AreEqual(GetTypeName(typeof(CompositeArray)), meta.TypeName);
             Assert.AreEqual(1, meta.Fields.Count);
             Assert.AreEqual(BinaryTypeNames.TypeNameArrayObject, meta.GetFieldTypeName("inArr"));
 
@@ -1254,7 +1270,7 @@ namespace Apache.Ignite.Core.Tests.Binary
 
             meta = binObj.GetBinaryType();
 
-            Assert.AreEqual(typeof(CompositeArray).Name, meta.TypeName);
+            Assert.AreEqual(GetTypeName(typeof(CompositeArray)), meta.TypeName);
             Assert.AreEqual(2, meta.Fields.Count);
             Assert.AreEqual(BinaryTypeNames.TypeNameArrayObject, meta.GetFieldTypeName("inArr"));
             Assert.AreEqual(BinaryTypeNames.TypeNameArrayObject, meta.GetFieldTypeName("outArr"));
@@ -1311,7 +1327,7 @@ namespace Apache.Ignite.Core.Tests.Binary
             // 1. Check meta.
             IBinaryType meta = binObj.GetBinaryType();
 
-            Assert.AreEqual(typeof(CompositeContainer).Name, meta.TypeName);
+            Assert.AreEqual(GetTypeName(typeof(CompositeContainer)), meta.TypeName);
 
             Assert.AreEqual(2, meta.Fields.Count);
             Assert.AreEqual(BinaryTypeNames.TypeNameCollection, meta.GetFieldTypeName("col"));
@@ -1378,7 +1394,7 @@ namespace Apache.Ignite.Core.Tests.Binary
 
             IBinaryType meta = outerbinObj.GetBinaryType();
 
-            Assert.AreEqual(typeof(NestedOuter).Name, meta.TypeName);
+            Assert.AreEqual(GetTypeName(typeof(NestedOuter)), meta.TypeName);
             Assert.AreEqual(1, meta.Fields.Count);
             Assert.AreEqual(BinaryTypeNames.TypeNameObject, meta.GetFieldTypeName("inner1"));
 
@@ -1386,7 +1402,7 @@ namespace Apache.Ignite.Core.Tests.Binary
 
             IBinaryType innerMeta = innerbinObj1.GetBinaryType();
 
-            Assert.AreEqual(typeof(NestedInner).Name, innerMeta.TypeName);
+            Assert.AreEqual(GetTypeName(typeof(NestedInner)), innerMeta.TypeName);
             Assert.AreEqual(1, innerMeta.Fields.Count);
             Assert.AreEqual(BinaryTypeNames.TypeNameInt, innerMeta.GetFieldTypeName("Val"));
 
@@ -1605,10 +1621,12 @@ namespace Apache.Ignite.Core.Tests.Binary
 
             binary.ToBinary<IBinaryObject>(new DecimalHolder());
 
+            var typeName = GetTypeName(typeof(DecimalHolder));
+
             // All meta
             var allMetas = binary.GetBinaryTypes();
 
-            var decimalMeta = allMetas.Single(x => x.TypeName == "DecimalHolder");
+            var decimalMeta = allMetas.Single(x => x.TypeName == typeName);
 
             Assert.AreEqual(new[] {"val", "valArr"}, decimalMeta.Fields);
 
@@ -1618,12 +1636,12 @@ namespace Apache.Ignite.Core.Tests.Binary
             Assert.AreEqual(new[] {"val", "valArr"}, decimalMeta.Fields);
             
             // By type id
-            decimalMeta = binary.GetBinaryType(binary.GetTypeId("DecimalHolder"));
+            decimalMeta = binary.GetBinaryType(binary.GetTypeId(typeName));
 
             Assert.AreEqual(new[] {"val", "valArr"}, decimalMeta.Fields);
 
             // By type name
-            decimalMeta = binary.GetBinaryType("DecimalHolder");
+            decimalMeta = binary.GetBinaryType(typeName);
 
             Assert.AreEqual(new[] {"val", "valArr"}, decimalMeta.Fields);
         }
@@ -1638,7 +1656,7 @@ namespace Apache.Ignite.Core.Tests.Binary
             var binEnums = new[]
             {
                 binary.BuildEnum(typeof (TestEnumRegistered), val),
-                binary.BuildEnum(typeof (TestEnumRegistered).Name, val)
+                binary.BuildEnum(GetTypeName(typeof (TestEnumRegistered)), val)
             };
 
             foreach (var binEnum in binEnums)
@@ -2086,18 +2104,30 @@ namespace Apache.Ignite.Core.Tests.Binary
     public class NameMapper : IBinaryNameMapper
     {
         /** */
+        private readonly IBinaryNameMapper _baseMapper;
+
+        /** */
         public const string TestTypeName = "NameMapperTestType";
 
         /** */
         public const string TestFieldName = "NameMapperTestField";
 
+        /// <summary>
+        /// Initializes a new instance of the <see cref="NameMapper" /> class.
+        /// </summary>
+        /// <param name="baseMapper">The base mapper.</param>
+        public NameMapper(IBinaryNameMapper baseMapper)
+        {
+            _baseMapper = baseMapper;
+        }
+
         /** <inheritdoc /> */
         public string GetTypeName(string name)
         {
-            if (name == TestTypeName)
-                return name + "_";
+            if (name == typeof(NameMapperTestType).AssemblyQualifiedName)
+                return TestTypeName + "_";
 
-            return name;
+            return _baseMapper.GetTypeName(name);
         }
 
         /** <inheritdoc /> */

http://git-wip-us.apache.org/repos/asf/ignite/blob/3e3b91a8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryBuilderSelfTestSimpleName.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryBuilderSelfTestSimpleName.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryBuilderSelfTestSimpleName.cs
new file mode 100644
index 0000000..918f82d
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryBuilderSelfTestSimpleName.cs
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace Apache.Ignite.Core.Tests.Binary
+{
+    using Apache.Ignite.Core.Binary;
+
+    /// <summary>
+    /// Builder test with simple names.
+    /// </summary>
+    public class BinaryBuilderSelfTestSimpleName : BinaryBuilderSelfTest
+    {
+        /** <inheritdoc /> */
+        protected override IBinaryNameMapper GetNameMapper()
+        {
+            return BinaryBasicNameMapper.SimpleNameInstance;
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/3e3b91a8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryCompactFooterInteropTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryCompactFooterInteropTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryCompactFooterInteropTest.cs
index 76ef999..bda3438 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryCompactFooterInteropTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryCompactFooterInteropTest.cs
@@ -141,6 +141,9 @@ namespace Apache.Ignite.Core.Tests.Binary
                 BinaryConfiguration = new BinaryConfiguration(
                     typeof (PlatformComputeBinarizable),
                     typeof (PlatformComputeNetBinarizable))
+                {
+                    NameMapper = BinaryBasicNameMapper.SimpleNameInstance
+                }
             };
         }
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/3e3b91a8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryDynamicRegistrationTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryDynamicRegistrationTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryDynamicRegistrationTest.cs
index 24f5e7c..687b1f5 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryDynamicRegistrationTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryDynamicRegistrationTest.cs
@@ -293,7 +293,15 @@ namespace Apache.Ignite.Core.Tests.Binary
         [Test]
         public void TestJavaInterop()
         {
-            using (var ignite = Ignition.Start(TestUtils.GetTestConfiguration()))
+            var cfg = new IgniteConfiguration(TestUtils.GetTestConfiguration())
+            {
+                BinaryConfiguration = new BinaryConfiguration
+                {
+                    NameMapper = BinaryBasicNameMapper.SimpleNameInstance
+                }
+            };
+
+            using (var ignite = Ignition.Start(cfg))
             {
                 var cacheCfg = new CacheConfiguration(null, new QueryEntity(typeof(PlatformComputeBinarizable))
                 {

http://git-wip-us.apache.org/repos/asf/ignite/blob/3e3b91a8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryNameMapperTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryNameMapperTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryNameMapperTest.cs
new file mode 100644
index 0000000..b3ace97
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinaryNameMapperTest.cs
@@ -0,0 +1,108 @@
+\ufeff/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace Apache.Ignite.Core.Tests.Binary
+{
+    using System.Collections.Generic;
+    using Apache.Ignite.Core.Binary;
+    using NUnit.Framework;
+
+    /// <summary>
+    /// Tests binary name mapper.
+    /// </summary>
+    public class BinaryNameMapperTest
+    {
+        /// <summary>
+        /// Tests full name mode.
+        /// </summary>
+        [Test]
+        public void TestFullName()
+        {
+            var mapper = new BinaryBasicNameMapper();
+            Assert.IsFalse(mapper.IsSimpleName);
+
+            // Simple type.
+            Assert.AreEqual("System.Int32", mapper.GetTypeName(typeof(int).AssemblyQualifiedName));
+            Assert.AreEqual("System.Int32", mapper.GetTypeName(typeof(int).FullName));
+
+            // Array.
+            Assert.AreEqual("System.String[]", mapper.GetTypeName(typeof(string[]).AssemblyQualifiedName));
+            Assert.AreEqual("System.String[]", mapper.GetTypeName(typeof(string[]).FullName));
+
+            // Generics.
+            Assert.AreEqual("System.Collections.Generic.List`1[[System.String]]", 
+                mapper.GetTypeName(typeof(List<string>).AssemblyQualifiedName));
+            
+            Assert.AreEqual("System.Collections.Generic.Dictionary`2[[System.Int32],[System.String]]", 
+                mapper.GetTypeName(typeof(Dictionary<int, string>).AssemblyQualifiedName));
+            
+            Assert.AreEqual("Apache.Ignite.Core.Tests.Binary.BinaryNameMapperTest+Bar`1[[Apache.Ignite.Core." +
+                            "Tests.Binary.BinaryNameMapperTest+Foo]]", 
+                            mapper.GetTypeName(typeof(Bar<Foo>).AssemblyQualifiedName));
+
+            Assert.AreEqual("Apache.Ignite.Core.Tests.Binary.BinaryNameMapperTest+Bar`1[[Apache.Ignite.Core.Tests" +
+                            ".Binary.BinaryNameMapperTest+Foo]][]", 
+                            mapper.GetTypeName(typeof(Bar<Foo>[]).AssemblyQualifiedName));
+            
+            Assert.AreEqual("Apache.Ignite.Core.Tests.Binary.BinaryNameMapperTest+Bar`1[[Apache.Ignite.Core.Tests." +
+                            "Binary.BinaryNameMapperTest+Foo[]]][]", 
+                            mapper.GetTypeName(typeof(Bar<Foo[]>[]).AssemblyQualifiedName));
+        }
+
+        /// <summary>
+        /// Tests simple name mode.
+        /// </summary>
+        [Test]
+        public void TestSimpleName()
+        {
+            var mapper = new BinaryBasicNameMapper {IsSimpleName = true};
+                        
+            // Simple type.
+            Assert.AreEqual("Int32", mapper.GetTypeName(typeof(int).AssemblyQualifiedName));
+            Assert.AreEqual("Int32", mapper.GetTypeName(typeof(int).FullName));
+
+            // Array.
+            Assert.AreEqual("String[]", mapper.GetTypeName(typeof(string[]).AssemblyQualifiedName));
+            Assert.AreEqual("String[]", mapper.GetTypeName(typeof(string[]).FullName));
+
+            // Generics.
+            Assert.AreEqual("List`1[[String]]", mapper.GetTypeName(typeof(List<string>).AssemblyQualifiedName));
+            Assert.AreEqual("Dictionary`2[[Int32],[String]]", 
+                mapper.GetTypeName(typeof(Dictionary<int, string>).AssemblyQualifiedName));
+            Assert.AreEqual("Bar`1[[Foo]]", mapper.GetTypeName(typeof(Bar<Foo>).AssemblyQualifiedName));
+            Assert.AreEqual("Bar`1[[Foo]][]", mapper.GetTypeName(typeof(Bar<Foo>[]).AssemblyQualifiedName));
+            Assert.AreEqual("Bar`1[[Foo[]]][]", mapper.GetTypeName(typeof(Bar<Foo[]>[]).AssemblyQualifiedName));
+        }
+
+        /// <summary>
+        /// Nested class.
+        /// </summary>
+        private class Foo
+        {
+            // No-op.
+        }
+
+        /// <summary>
+        /// Nested generic class.
+        /// </summary>
+        // ReSharper disable once UnusedTypeParameter
+        private class Bar<T>
+        {
+            // No-op.
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/3e3b91a8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinarySelfTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinarySelfTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinarySelfTest.cs
index bde8166..bdc0d65 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinarySelfTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinarySelfTest.cs
@@ -63,17 +63,28 @@ namespace Apache.Ignite.Core.Tests.Binary
         [TestFixtureSetUp]
         public void BeforeTest()
         {
-            _marsh = new Marshaller(new BinaryConfiguration{CompactFooter = GetCompactFooter()});
+            _marsh = new Marshaller(new BinaryConfiguration
+            {
+                CompactFooter = GetCompactFooter(),
+                NameMapper = GetNameMapper()
+            });
         }
 
         /// <summary>
         /// Gets the binary configuration.
         /// </summary>
-        /// <returns></returns>
         protected virtual bool GetCompactFooter()
         {
             return true;
         }
+
+        /// <summary>
+        /// Gets the name mapper.
+        /// </summary>
+        protected virtual IBinaryNameMapper GetNameMapper()
+        {
+            return BinaryBasicNameMapper.FullNameInstance;
+        }
         
         /**
          * <summary>Check write of primitive boolean.</summary>
@@ -1550,7 +1561,10 @@ namespace Apache.Ignite.Core.Tests.Binary
         [Test]
         public void TestBinaryConfigurationValidation()
         {
-            var cfg = new BinaryConfiguration(typeof (PropertyType)) {Types = new[] {"PropertyType"}};
+            var cfg = new BinaryConfiguration(typeof (PropertyType))
+            {
+                Types = new[] {typeof(PropertyType).AssemblyQualifiedName}
+            };
 
             // ReSharper disable once ObjectCreationAsStatement
             Assert.Throws<BinaryObjectException>(() => new Marshaller(cfg));

http://git-wip-us.apache.org/repos/asf/ignite/blob/3e3b91a8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinarySelfTestSimpleName.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinarySelfTestSimpleName.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinarySelfTestSimpleName.cs
new file mode 100644
index 0000000..96ccb0b
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/BinarySelfTestSimpleName.cs
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace Apache.Ignite.Core.Tests.Binary
+{
+    using Apache.Ignite.Core.Binary;
+
+    /// <summary>
+    /// Test with simple name mapper.
+    /// </summary>
+    public class BinarySelfTestSimpleName : BinarySelfTest
+    {
+        /** <inheritdoc /> */
+        protected override IBinaryNameMapper GetNameMapper()
+        {
+            return BinaryBasicNameMapper.SimpleNameInstance;
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/3e3b91a8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/Serializable/SqlDmlTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/Serializable/SqlDmlTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/Serializable/SqlDmlTest.cs
index b59247e..8495a30 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/Serializable/SqlDmlTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/Serializable/SqlDmlTest.cs
@@ -54,6 +54,9 @@ namespace Apache.Ignite.Core.Tests.Binary.Serializable
             var cfg = new IgniteConfiguration(TestUtils.GetTestConfiguration())
             {
                 BinaryConfiguration = new BinaryConfiguration(typeof(SimpleSerializable))
+                {
+                    NameMapper = BinaryBasicNameMapper.SimpleNameInstance
+                }
             };
 
             _ignite = Ignition.Start(cfg);

http://git-wip-us.apache.org/repos/asf/ignite/blob/3e3b91a8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/TypeNameParserTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/TypeNameParserTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/TypeNameParserTest.cs
new file mode 100644
index 0000000..f3394a3
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Binary/TypeNameParserTest.cs
@@ -0,0 +1,232 @@
+\ufeff/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// ReSharper disable UnusedTypeParameter
+namespace Apache.Ignite.Core.Tests.Binary
+{
+    using System;
+    using System.Collections;
+    using System.Collections.Generic;
+    using System.Linq;
+    using Apache.Ignite.Core.Common;
+    using Apache.Ignite.Core.Impl.Binary;
+    using NUnit.Framework;
+
+    /// <summary>
+    /// Tests the type name parser.
+    /// </summary>
+    public class TypeNameParserTest
+    {
+        /// <summary>
+        /// Tests simple types.
+        /// </summary>
+        [Test]
+        public void TestSimpleTypes()
+        {
+            // One letter.
+            var res = TypeNameParser.Parse("x");
+            Assert.AreEqual("x", res.GetFullName());
+            Assert.AreEqual("x", res.GetName());
+            Assert.AreEqual(0, res.NameStart);
+            Assert.AreEqual(0, res.NameEnd);
+            Assert.AreEqual(-1, res.AssemblyStart);
+            Assert.AreEqual(-1, res.AssemblyEnd);
+            Assert.IsNull(res.Generics);
+
+            // Without assembly.
+            res = TypeNameParser.Parse("System.Int");
+
+            Assert.AreEqual(7, res.NameStart);
+            Assert.AreEqual(9, res.NameEnd);
+            Assert.IsNull(res.Generics);
+            Assert.AreEqual(-1, res.AssemblyStart);
+
+            // With assembly.
+            res = TypeNameParser.Parse("System.Int, myasm, Ver=1");
+
+            Assert.AreEqual(7, res.NameStart);
+            Assert.AreEqual(9, res.NameEnd);
+            Assert.IsNull(res.Generics);
+            Assert.AreEqual(12, res.AssemblyStart);
+
+            // Real types.
+            CheckType(GetType());
+            CheckType(typeof(string));
+            CheckType(typeof(IDictionary));
+
+            // Nested types.
+            CheckType(typeof(Nested));
+            CheckType(typeof(Nested.Nested2));
+        }
+
+        /// <summary>
+        /// Tests generic types.
+        /// </summary>
+        [Test]
+        public void TestGenericTypes()
+        {
+            // Custom strings.
+            var res = TypeNameParser.Parse("List`1[[Int]]");
+            Assert.AreEqual("List`1", res.GetName());
+            Assert.AreEqual("List`1", res.GetFullName());
+            Assert.AreEqual("Int", res.Generics.Single().GetName());
+            Assert.AreEqual("Int", res.Generics.Single().GetFullName());
+
+            // One arg.
+            res = TypeNameParser.Parse(typeof(List<int>).AssemblyQualifiedName);
+            Assert.AreEqual("List`1", res.GetName());
+            Assert.AreEqual("System.Collections.Generic.List`1", res.GetFullName());
+            Assert.IsTrue(res.GetAssemblyName().StartsWith("mscorlib,"));
+
+            Assert.AreEqual(1, res.Generics.Count);
+            var gen = res.Generics.Single();
+            Assert.AreEqual("Int32", gen.GetName());
+            Assert.AreEqual("System.Int32", gen.GetFullName());
+            Assert.IsTrue(gen.GetAssemblyName().StartsWith("mscorlib,"));
+
+            // Two args.
+            res = TypeNameParser.Parse(typeof(Dictionary<int, string>).AssemblyQualifiedName);
+            Assert.AreEqual("Dictionary`2", res.GetName());
+            Assert.AreEqual("System.Collections.Generic.Dictionary`2", res.GetFullName());
+            Assert.IsTrue(res.GetAssemblyName().StartsWith("mscorlib,"));
+
+            Assert.AreEqual(2, res.Generics.Count);
+
+            gen = res.Generics.First();
+            Assert.AreEqual("Int32", gen.GetName());
+            Assert.AreEqual("System.Int32", gen.GetFullName());
+            Assert.IsTrue(gen.GetAssemblyName().StartsWith("mscorlib,"));
+
+            gen = res.Generics.Last();
+            Assert.AreEqual("String", gen.GetName());
+            Assert.AreEqual("System.String", gen.GetFullName());
+            Assert.IsTrue(gen.GetAssemblyName().StartsWith("mscorlib,"));
+
+            // Nested args.
+            res = TypeNameParser.Parse(typeof(Dictionary<int, List<string>>).FullName);
+
+            Assert.AreEqual("Dictionary`2", res.GetName());
+            Assert.AreEqual("System.Collections.Generic.Dictionary`2", res.GetFullName());
+            Assert.IsNull(res.GetAssemblyName());
+
+            Assert.AreEqual(2, res.Generics.Count);
+
+            gen = res.Generics.Last();
+            Assert.AreEqual("List`1", gen.GetName());
+            Assert.AreEqual("System.Collections.Generic.List`1", gen.GetFullName());
+            Assert.IsTrue(gen.GetAssemblyName().StartsWith("mscorlib,"));
+            Assert.AreEqual(1, gen.Generics.Count);
+
+            gen = gen.Generics.Single();
+            Assert.AreEqual("String", gen.GetName());
+            Assert.AreEqual("System.String", gen.GetFullName());
+            Assert.IsTrue(gen.GetAssemblyName().StartsWith("mscorlib,"));
+
+            // Nested class.
+            res = TypeNameParser.Parse(typeof(NestedGeneric<int>).FullName);
+
+            Assert.AreEqual("NestedGeneric`1", res.GetName());
+            Assert.AreEqual("Apache.Ignite.Core.Tests.Binary.TypeNameParserTest+NestedGeneric`1", res.GetFullName());
+
+            gen = res.Generics.Single();
+            Assert.AreEqual("Int32", gen.GetName());
+            Assert.AreEqual("System.Int32", gen.GetFullName());
+
+            res = TypeNameParser.Parse(typeof(NestedGeneric<int>.NestedGeneric2<string>).AssemblyQualifiedName);
+            
+            Assert.AreEqual("NestedGeneric2`1", res.GetName());
+            Assert.AreEqual("Apache.Ignite.Core.Tests.Binary.TypeNameParserTest+NestedGeneric`1+NestedGeneric2`1", 
+                res.GetFullName());
+
+            Assert.AreEqual(2, res.Generics.Count);
+            Assert.AreEqual("Int32", res.Generics.First().GetName());
+            Assert.AreEqual("String", res.Generics.Last().GetName());
+        }
+
+        /// <summary>
+        /// Tests arrays.
+        /// </summary>
+        [Test]
+        public void TestArrays()
+        {
+            CheckType(typeof(int[]));
+            CheckType(typeof(int[,]));
+            CheckType(typeof(int[][]));
+            
+            CheckType(typeof(List<int>[]));
+            CheckType(typeof(List<int>[,]));
+            CheckType(typeof(List<int>[][]));
+        }
+
+        /// <summary>
+        /// Tests invalid type names.
+        /// </summary>
+        [Test]
+        public void TestInvalidTypes()
+        {
+            Assert.Throws<ArgumentException>(() => TypeNameParser.Parse(null));
+            Assert.Throws<ArgumentException>(() => TypeNameParser.Parse(""));
+
+            Assert.Throws<IgniteException>(() => TypeNameParser.Parse("x["));
+            Assert.Throws<IgniteException>(() => TypeNameParser.Parse("x[[]"));
+            Assert.Throws<IgniteException>(() => TypeNameParser.Parse("x`["));
+            Assert.Throws<IgniteException>(() => TypeNameParser.Parse("x`]"));
+            Assert.Throws<IgniteException>(() => TypeNameParser.Parse("x`[ ]"));
+            Assert.Throws<IgniteException>(() => TypeNameParser.Parse("x,"));
+            Assert.Throws<IgniteException>(() => TypeNameParser.Parse("x`x"));
+            Assert.Throws<IgniteException>(() => TypeNameParser.Parse("x`2[x"));
+            Assert.Throws<IgniteException>(() => TypeNameParser.Parse("x`2xx"));
+        }
+
+        /// <summary>
+        /// Checks the type.
+        /// </summary>
+        private static void CheckType(Type type)
+        {
+            var name = type.AssemblyQualifiedName;
+
+            Assert.IsNotNull(name);
+
+            var res = TypeNameParser.Parse(name);
+
+            Assert.AreEqual(type.Name, res.GetName() + res.GetArray());
+
+            if (res.Generics == null)
+            {
+                Assert.AreEqual(type.FullName, res.GetFullName() + res.GetArray());
+            }
+
+            Assert.AreEqual(type.FullName.Length + 2, res.AssemblyStart);
+        }
+
+        private class Nested
+        {
+            public class Nested2
+            {
+                // No-op.
+            }
+        }
+
+        private class NestedGeneric<T>
+        {
+            public class NestedGeneric2<T2>
+            {
+                // No-op.
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/3e3b91a8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheDmlQueriesTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheDmlQueriesTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheDmlQueriesTest.cs
index 6afeff4..d79844e 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheDmlQueriesTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheDmlQueriesTest.cs
@@ -39,12 +39,23 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
             var cfg = new IgniteConfiguration(TestUtils.GetTestConfiguration())
             {
                 BinaryConfiguration = new BinaryConfiguration(typeof(Foo), typeof(Key), typeof(Key2))
+                {
+                    NameMapper = GetNameMapper()
+                }
             };
 
             Ignition.Start(cfg);
         }
 
         /// <summary>
+        /// Gets the name mapper.
+        /// </summary>
+        protected virtual IBinaryNameMapper GetNameMapper()
+        {
+            return BinaryBasicNameMapper.FullNameInstance;
+        }
+
+        /// <summary>
         /// Tears down test fixture.
         /// </summary>
         [TestFixtureTearDown]

http://git-wip-us.apache.org/repos/asf/ignite/blob/3e3b91a8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheDmlQueriesTestSimpleName.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheDmlQueriesTestSimpleName.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheDmlQueriesTestSimpleName.cs
new file mode 100644
index 0000000..467d78f
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheDmlQueriesTestSimpleName.cs
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace Apache.Ignite.Core.Tests.Cache.Query
+{
+    using Apache.Ignite.Core.Binary;
+    using NUnit.Framework;
+
+    /// <summary>
+    /// Test with simple name mapper.
+    /// </summary>
+    [TestFixture]
+    public class CacheDmlQueriesTestSimpleName : CacheDmlQueriesTest
+    {
+        /** <inheritdoc /> */
+        protected override IBinaryNameMapper GetNameMapper()
+        {
+            return BinaryBasicNameMapper.SimpleNameInstance;
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/3e3b91a8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheLinqTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheLinqTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheLinqTest.cs
index 876b0be..b2213d8 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheLinqTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheLinqTest.cs
@@ -119,17 +119,28 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
         /// <summary>
         /// Gets the configuration.
         /// </summary>
-        private static IgniteConfiguration GetConfig(string gridName = null)
+        private IgniteConfiguration GetConfig(string gridName = null)
         {
             return new IgniteConfiguration(TestUtils.GetTestConfiguration())
             {
                 BinaryConfiguration = new BinaryConfiguration(typeof(Person),
-                    typeof(Organization), typeof(Address), typeof(Role), typeof(RoleKey), typeof(Numerics)),
+                    typeof(Organization), typeof(Address), typeof(Role), typeof(RoleKey), typeof(Numerics))
+                {
+                    NameMapper = GetNameMapper()
+                },
                 IgniteInstanceName = gridName
             };
         }
 
         /// <summary>
+        /// Gets the name mapper.
+        /// </summary>
+        protected virtual IBinaryNameMapper GetNameMapper()
+        {
+            return BinaryBasicNameMapper.FullNameInstance;
+        }
+
+        /// <summary>
         /// Fixture tear down.
         /// </summary>
         [TestFixtureTearDown]

http://git-wip-us.apache.org/repos/asf/ignite/blob/3e3b91a8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheLinqTestSimpleName.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheLinqTestSimpleName.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheLinqTestSimpleName.cs
new file mode 100644
index 0000000..9743e60
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheLinqTestSimpleName.cs
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace Apache.Ignite.Core.Tests.Cache.Query
+{
+    using Apache.Ignite.Core.Binary;
+    using NUnit.Framework;
+
+    /// <summary>
+    /// LINQ test with simple name mapper.
+    /// </summary>
+    [TestFixture]
+    public class CacheLinqTestSimpleName : CacheLinqTest
+    {
+        /** <inheritdoc /> */
+        protected override IBinaryNameMapper GetNameMapper()
+        {
+            return BinaryBasicNameMapper.SimpleNameInstance;
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/3e3b91a8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesCodeConfigurationTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesCodeConfigurationTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesCodeConfigurationTest.cs
index 8157a56..e25ddc0 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesCodeConfigurationTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesCodeConfigurationTest.cs
@@ -40,10 +40,8 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
         [Test]
         public void TestQueryEntityConfiguration()
         {
-            var cfg = new IgniteConfiguration
+            var cfg = new IgniteConfiguration(TestUtils.GetTestConfiguration())
             {
-                JvmOptions = TestUtils.TestJavaOptions(),
-                JvmClasspath = TestUtils.CreateTestClasspath(),
                 BinaryConfiguration = new BinaryConfiguration(typeof (QueryPerson)),
                 CacheConfiguration = new[]
                 {
@@ -132,12 +130,10 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
         [Test]
         public void TestAttributeConfigurationQuery()
         {
-            var cfg = new IgniteConfiguration
+            var cfg = new IgniteConfiguration(TestUtils.GetTestConfiguration())
             {
-                JvmOptions = TestUtils.TestJavaOptions(),
-                JvmClasspath = TestUtils.CreateTestClasspath(),
                 BinaryConfiguration = new BinaryConfiguration(
-                    typeof (AttributeQueryPerson), typeof (AttributeQueryAddress)),
+                    typeof (AttributeQueryPerson), typeof (AttributeQueryAddress))
             };
 
             using (var ignite = Ignition.Start(cfg))

http://git-wip-us.apache.org/repos/asf/ignite/blob/3e3b91a8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesTest.cs
index d6705d4..5cbec0d 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesTest.cs
@@ -35,7 +35,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
     /// <summary>
     /// Queries tests.
     /// </summary>
-    public sealed class CacheQueriesTest
+    public class CacheQueriesTest
     {
         /** Grid count. */
         private const int GridCnt = 2;
@@ -66,7 +66,8 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
                         new BinaryTypeConfiguration(typeof (QueryPerson)),
                         new BinaryTypeConfiguration(typeof (BinarizableScanQueryFilter<QueryPerson>)),
                         new BinaryTypeConfiguration(typeof (BinarizableScanQueryFilter<BinaryObject>))
-                    }
+                    },
+                    NameMapper = GetNameMapper()
                 },
                 JvmClasspath = TestUtils.CreateTestClasspath(),
                 JvmOptions = TestUtils.TestJavaOptions(),
@@ -80,6 +81,14 @@ namespace Apache.Ignite.Core.Tests.Cache.Query
                 Ignition.Start(cfg);
             }
         }
+        
+        /// <summary>
+        /// Gets the name mapper.
+        /// </summary>
+        protected virtual IBinaryNameMapper GetNameMapper()
+        {
+            return BinaryBasicNameMapper.FullNameInstance;
+        }
 
         /// <summary>
         /// 

http://git-wip-us.apache.org/repos/asf/ignite/blob/3e3b91a8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesTestSimpleName.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesTestSimpleName.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesTestSimpleName.cs
new file mode 100644
index 0000000..c8924bb
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesTestSimpleName.cs
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace Apache.Ignite.Core.Tests.Cache.Query
+{
+    using Apache.Ignite.Core.Binary;
+    using NUnit.Framework;
+
+    /// <summary>
+    /// Test with simple name mapper.
+    /// </summary>
+    [TestFixture]
+    public class CacheQueriesTestSimpleName : CacheQueriesTest
+    {
+        /** <inheritdoc /> */
+        protected override IBinaryNameMapper GetNameMapper()
+        {
+            return BinaryBasicNameMapper.SimpleNameInstance;
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/3e3b91a8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryAbstractTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryAbstractTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryAbstractTest.cs
index 57f3d00..a6b68bb 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryAbstractTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryAbstractTest.cs
@@ -91,27 +91,21 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
         [TestFixtureSetUp]
         public void SetUp()
         {
-            GC.Collect();
-            TestUtils.JvmDebug = true;
-
-            IgniteConfiguration cfg = new IgniteConfiguration();
-
-            BinaryConfiguration portCfg = new BinaryConfiguration();
-
-            ICollection<BinaryTypeConfiguration> portTypeCfgs = new List<BinaryTypeConfiguration>();
-
-            portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(BinarizableEntry)));
-            portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(BinarizableFilter)));
-            portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(KeepBinaryFilter)));
-
-            portCfg.TypeConfigurations = portTypeCfgs;
-
-            cfg.BinaryConfiguration = portCfg;
-            cfg.JvmClasspath = TestUtils.CreateTestClasspath();
-            cfg.JvmOptions = TestUtils.TestJavaOptions();
-            cfg.SpringConfigUrl = "config\\cache-query-continuous.xml";
+            var cfg = new IgniteConfiguration(TestUtils.GetTestConfiguration())
+            {
+                BinaryConfiguration = new BinaryConfiguration
+                {
+                    TypeConfigurations = new List<BinaryTypeConfiguration>
+                    {
+                        new BinaryTypeConfiguration(typeof(BinarizableEntry)),
+                        new BinaryTypeConfiguration(typeof(BinarizableFilter)),
+                        new BinaryTypeConfiguration(typeof(KeepBinaryFilter))
+                    }
+                },
+                SpringConfigUrl = "config\\cache-query-continuous.xml",
+                IgniteInstanceName = "grid-1"
+            };
 
-            cfg.IgniteInstanceName = "grid-1";
             grid1 = Ignition.Start(cfg);
             cache1 = grid1.GetCache<int, BinarizableEntry>(cacheName);
 
@@ -1179,7 +1173,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
 
                     IBinaryType meta = val.GetBinaryType();
 
-                    Assert.AreEqual(typeof(BinarizableEntry).Name, meta.TypeName);
+                    Assert.AreEqual(typeof(BinarizableEntry).FullName, meta.TypeName);
                 }
 
                 countDown.Signal();

http://git-wip-us.apache.org/repos/asf/ignite/blob/3e3b91a8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreTest.cs
index b62a0ec..309c77e 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreTest.cs
@@ -23,9 +23,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
     using System.Linq;
     using Apache.Ignite.Core.Binary;
     using Apache.Ignite.Core.Cache;
-    using Apache.Ignite.Core.Cache.Configuration;
     using Apache.Ignite.Core.Cache.Store;
-    using Apache.Ignite.Core.Common;
     using Apache.Ignite.Core.Impl;
     using NUnit.Framework;
 
@@ -156,7 +154,7 @@ namespace Apache.Ignite.Core.Tests.Cache.Store
 
             Assert.NotNull(meta);
 
-            Assert.AreEqual("Value", meta.TypeName);
+            Assert.AreEqual("Apache.Ignite.Core.Tests.Cache.Store.Value", meta.TypeName);
         }
 
         /// <summary>

http://git-wip-us.apache.org/repos/asf/ignite/blob/3e3b91a8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs
index b5b6c05..316e5d0 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs
@@ -1315,7 +1315,8 @@ namespace Apache.Ignite.Core.Tests.Compute
                         new BinaryTypeConfiguration(JavaBinaryCls),
                         new BinaryTypeConfiguration(typeof(PlatformComputeEnum)),
                         new BinaryTypeConfiguration(typeof(InteropComputeEnumFieldTest))
-                    }
+                    },
+                    NameMapper = BinaryBasicNameMapper.SimpleNameInstance
                 },
                 SpringConfigUrl = path
             };

http://git-wip-us.apache.org/repos/asf/ignite/blob/3e3b91a8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Compute/compute-grid2.xml
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Compute/compute-grid2.xml b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Compute/compute-grid2.xml
index d7f86f4..3774b51 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Compute/compute-grid2.xml
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/Compute/compute-grid2.xml
@@ -62,16 +62,6 @@
                         </bean>
                     </list>
                 </property>
-                <property name="idMapper">
-                    <bean class="org.apache.ignite.binary.BinaryBasicIdMapper">
-                        <constructor-arg value="true"/>
-                    </bean>
-                </property>
-                <property name="nameMapper">
-                    <bean class="org.apache.ignite.binary.BinaryBasicNameMapper">
-                        <constructor-arg value="true"/>
-                    </bean>
-                </property>
             </bean>
         </property>
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/3e3b91a8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/cache-binarizables.xml
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/cache-binarizables.xml b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/cache-binarizables.xml
index 2804131..97ec97e 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/cache-binarizables.xml
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/cache-binarizables.xml
@@ -35,14 +35,14 @@
                     <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetBinaryConfiguration">
                         <property name="types">
                             <list>
-                                <value>Apache.Ignite.Core.Tests.TestGenericBinarizable[System.Int64]</value>
-                                <value>Apache.Ignite.Core.Tests.TestGenericBinarizable[System.Type]</value>
-                                <value>Apache.Ignite.Core.Tests.TestGenericBinarizable[Apache.Ignite.Core.Tests.TestGenericBinarizable[System.Int64]]</value>
-                                <value>Apache.Ignite.Core.Tests.TestGenericBinarizable[System.Collections.Generic.List[System.Tuple[System.Int64,System.String]]]</value>
-                                <value>Apache.Ignite.Core.Tests.TestGenericBinarizable[System.Int64,System.String]</value>
-                                <value>Apache.Ignite.Core.Tests.TestGenericBinarizable[System.Int64,Apache.Ignite.Core.Tests.TestGenericBinarizable[System.String]]</value>
-                                <value>Apache.Ignite.Core.Tests.TestGenericBinarizable[System.Int64,System.String,System.Type]</value>
-                                <value>Apache.Ignite.Core.Tests.TestGenericBinarizable[System.Int64,System.String,Apache.Ignite.Core.Tests.TestGenericBinarizable[System.Int64,System.String,System.Type]]</value>
+                                <value>Apache.Ignite.Core.Tests.TestGenericBinarizable`1[[System.Int64]]</value>
+                                <value>Apache.Ignite.Core.Tests.TestGenericBinarizable`1[[System.Type]]</value>
+                                <value>Apache.Ignite.Core.Tests.TestGenericBinarizable`1[[Apache.Ignite.Core.Tests.TestGenericBinarizable`1[[System.Int64]]]]</value>
+                                <value>Apache.Ignite.Core.Tests.TestGenericBinarizable`1[[System.Collections.Generic.List`1[[System.Tuple`2[[System.Int64],[System.String]]]]]]</value>
+                                <value>Apache.Ignite.Core.Tests.TestGenericBinarizable`2[[System.Int64],[System.String]]</value>
+                                <value>Apache.Ignite.Core.Tests.TestGenericBinarizable`2[[System.Int64],[Apache.Ignite.Core.Tests.TestGenericBinarizable`1[[System.String]]]]</value>
+                                <value>Apache.Ignite.Core.Tests.TestGenericBinarizable`3[[System.Int64],[System.String],[System.Type]]</value>
+                                <value>Apache.Ignite.Core.Tests.TestGenericBinarizable`3[[System.Int64],[System.String],[Apache.Ignite.Core.Tests.TestGenericBinarizable`2[[System.Int64,System.String],[System.Type]]]]</value>
                             </list>
                         </property>
                     </bean>

http://git-wip-us.apache.org/repos/asf/ignite/blob/3e3b91a8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/cache-query-continuous.xml
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/cache-query-continuous.xml b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/cache-query-continuous.xml
index 5fc973b..1bea206 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/cache-query-continuous.xml
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/cache-query-continuous.xml
@@ -42,7 +42,7 @@
                     <property name="queryEntities">
                         <list>
                             <bean class="org.apache.ignite.cache.QueryEntity">
-                                <property name="valueType" value="BinarizableEntry"/>
+                                <property name="valueType" value="Apache.Ignite.Core.Tests.Cache.Query.Continuous.ContinuousQueryAbstractTest+BinarizableEntry"/>
                                 <property name="fields">
                                     <map>
                                         <entry key="val" value="java.lang.Integer"/>
@@ -82,7 +82,7 @@
                     <property name="queryEntities">
                         <list>
                             <bean class="org.apache.ignite.cache.QueryEntity">
-                                <property name="valueType" value="BinarizableEntry"/>
+                                <property name="valueType" value="Apache.Ignite.Core.Tests.Cache.Query.Continuous.ContinuousQueryAbstractTest+BinarizableEntry"/>
                                 <property name="fields">
                                     <map>
                                         <entry key="val" value="java.lang.Integer"/>
@@ -121,7 +121,7 @@
                     <property name="queryEntities">
                         <list>
                             <bean class="org.apache.ignite.cache.QueryEntity">
-                                <property name="valueType" value="BinarizableEntry"/>
+                                <property name="valueType" value="Apache.Ignite.Core.Tests.Cache.Query.Continuous.ContinuousQueryAbstractTest+BinarizableEntry"/>
                                 <property name="fields">
                                     <map>
                                         <entry key="val" value="java.lang.Integer"/>
@@ -160,7 +160,7 @@
                     <property name="queryEntities">
                         <list>
                             <bean class="org.apache.ignite.cache.QueryEntity">
-                                <property name="valueType" value="BinarizableEntry"/>
+                                <property name="valueType" value="Apache.Ignite.Core.Tests.Cache.Query.Continuous.ContinuousQueryAbstractTest+BinarizableEntry"/>
                                 <property name="fields">
                                     <map>
                                         <entry key="val" value="java.lang.Integer"/>

http://git-wip-us.apache.org/repos/asf/ignite/blob/3e3b91a8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/cache-query.xml
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/cache-query.xml b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/cache-query.xml
index dd5d4d9..4f92c72 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/cache-query.xml
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/cache-query.xml
@@ -60,7 +60,7 @@
                     <property name="queryEntities">
                         <list>
                             <bean class="org.apache.ignite.cache.QueryEntity">
-                                <property name="valueType" value="QueryPerson"/>
+                                <property name="valueType" value="Apache.Ignite.Core.Tests.Cache.Query.QueryPerson"/>
                                 <property name="fields">
                                     <util:map map-class="java.util.LinkedHashMap">
                                         <entry key="age" value="int" />

http://git-wip-us.apache.org/repos/asf/ignite/blob/3e3b91a8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Services/ServicesTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Services/ServicesTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Services/ServicesTest.cs
index c4d4279..33c44a6 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Services/ServicesTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Services/ServicesTest.cs
@@ -677,6 +677,9 @@ namespace Apache.Ignite.Core.Tests.Services
                     typeof (TestIgniteServiceBinarizableErr),
                     typeof (PlatformComputeBinarizable),
                     typeof (BinarizableObject))
+                {
+                    NameMapper = BinaryBasicNameMapper.SimpleNameInstance
+                }
             };
         }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/3e3b91a8/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
index 16e2552..a298f6f 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
@@ -91,6 +91,7 @@
     <Reference Include="System.Xml" />
   </ItemGroup>
   <ItemGroup>
+    <Compile Include="Binary\BinaryBasicNameMapper.cs" />
     <Compile Include="Common\ExceptionFactory.cs" />
     <Compile Include="Events\IEventStorageSpi.cs" />
     <Compile Include="Events\MemoryEventStorageSpi.cs" />
@@ -191,6 +192,7 @@
     <Compile Include="Impl\Binary\DeserializationCallbackProcessor.cs" />
     <Compile Include="Impl\Binary\ReflectionUtils.cs" />
     <Compile Include="Cache\Affinity\AffinityFunctionBase.cs" />
+    <Compile Include="Impl\Binary\TypeNameParser.cs" />
     <Compile Include="Impl\Cache\Store\CacheStore.cs" />
     <Compile Include="Impl\Cache\Store\ICacheStoreInternal.cs" />
     <Compile Include="Impl\Transactions\CacheTransactionManager.cs" />

http://git-wip-us.apache.org/repos/asf/ignite/blob/3e3b91a8/modules/platforms/dotnet/Apache.Ignite.Core/Binary/BinaryBasicNameMapper.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Binary/BinaryBasicNameMapper.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Binary/BinaryBasicNameMapper.cs
new file mode 100644
index 0000000..0a6406b
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Binary/BinaryBasicNameMapper.cs
@@ -0,0 +1,129 @@
+\ufeff/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace Apache.Ignite.Core.Binary
+{
+    using System;
+    using System.Text;
+    using Apache.Ignite.Core.Impl.Binary;
+    using Apache.Ignite.Core.Impl.Common;
+
+    /// <summary>
+    /// Base binary name mapper implementation.
+    /// </summary>
+    public class BinaryBasicNameMapper : IBinaryNameMapper
+    {
+        /// <summary>
+        /// The simple name instance.
+        /// </summary>
+        internal static readonly BinaryBasicNameMapper SimpleNameInstance = new BinaryBasicNameMapper
+        {
+            IsSimpleName = true
+        };
+
+        /// <summary>
+        /// The full name instance.
+        /// </summary>
+        internal static readonly BinaryBasicNameMapper FullNameInstance = new BinaryBasicNameMapper();
+
+        /// <summary>
+        /// Gets or sets a value indicating whether this instance maps to simple type names.
+        /// </summary>
+        public bool IsSimpleName { get; set; }
+
+        /// <summary>
+        /// Gets the type name.
+        /// </summary>
+        public string GetTypeName(string name)
+        {
+            IgniteArgumentCheck.NotNullOrEmpty(name, "typeName");
+
+            var parsedName = TypeNameParser.Parse(name);
+
+            if (parsedName.Generics == null)
+            {
+                // Generics are rare, use simpler logic for the common case.
+                var res = IsSimpleName ? parsedName.GetName() : parsedName.GetFullName();
+                
+                var arr = parsedName.GetArray();
+
+                if (arr != null)
+                {
+                    res += arr;
+                }
+
+                return res;
+            }
+
+            var nameFunc = IsSimpleName
+                ? (Func<TypeNameParser, string>) (x => x.GetName())
+                : (x => x.GetFullName());
+
+            return BuildTypeName(parsedName, new StringBuilder(), nameFunc).ToString();
+        }
+
+        /// <summary>
+        /// Gets the field name.
+        /// </summary>
+        public string GetFieldName(string name)
+        {
+            return name;
+        }
+
+        /// <summary>
+        /// Builds the type name.
+        /// </summary>
+        private static StringBuilder BuildTypeName(TypeNameParser typeName, StringBuilder sb, 
+            Func<TypeNameParser, string> typeNameFunc)
+        {
+            sb.Append(typeNameFunc(typeName));
+
+            var generics = typeName.Generics;
+
+            if (generics != null)
+            {
+                sb.Append('[');
+
+                var first = true;
+
+                foreach (var genArg in generics)
+                {
+                    if (first)
+                    {
+                        first = false;
+                    }
+                    else
+                    {
+                        sb.Append(',');
+                    }
+
+                    sb.Append('[');
+
+                    BuildTypeName(genArg, sb, typeNameFunc);
+
+                    sb.Append(']');
+                }
+
+                sb.Append(']');
+            }
+
+            sb.Append(typeName.GetArray());
+
+            return sb;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/3e3b91a8/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/QueryEntity.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/QueryEntity.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/QueryEntity.cs
index b67f206..8aadf0e 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/QueryEntity.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/QueryEntity.cs
@@ -105,7 +105,7 @@ namespace Apache.Ignite.Core.Cache.Configuration
 
                 KeyTypeName = value == null
                     ? null
-                    : (JavaTypes.GetJavaTypeName(value) ?? BinaryUtils.GetTypeName(value));
+                    : (JavaTypes.GetJavaTypeName(value) ?? BinaryUtils.GetSqlTypeName(value));
 
                 _keyType = value;
             }
@@ -141,7 +141,7 @@ namespace Apache.Ignite.Core.Cache.Configuration
 
                 ValueTypeName = value == null
                     ? null
-                    : (JavaTypes.GetJavaTypeName(value) ?? BinaryUtils.GetTypeName(value));
+                    : (JavaTypes.GetJavaTypeName(value) ?? BinaryUtils.GetSqlTypeName(value));
 
                 _valueType = value;
             }

http://git-wip-us.apache.org/repos/asf/ignite/blob/3e3b91a8/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/QueryField.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/QueryField.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/QueryField.cs
index c33aa57..a1ebbd7 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/QueryField.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/QueryField.cs
@@ -89,7 +89,7 @@ namespace Apache.Ignite.Core.Cache.Configuration
             {
                 FieldTypeName = value == null
                     ? null
-                    : (JavaTypes.GetJavaTypeName(value) ?? BinaryUtils.GetTypeName(value));
+                    : (JavaTypes.GetJavaTypeName(value) ?? BinaryUtils.GetSqlTypeName(value));
 
                 _type = value;
             }

http://git-wip-us.apache.org/repos/asf/ignite/blob/3e3b91a8/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs
index 24a4364..85c7548 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs
@@ -272,6 +272,10 @@ namespace Apache.Ignite.Core
                 {
                     writer.WriteBoolean(false);
                 }
+
+                // Name mapper.
+                var mapper = BinaryConfiguration.NameMapper as BinaryBasicNameMapper;
+                writer.WriteBoolean(mapper != null && mapper.IsSimpleName);
             }
             else
             {
@@ -430,7 +434,14 @@ namespace Apache.Ignite.Core
                 BinaryConfiguration = BinaryConfiguration ?? new BinaryConfiguration();
 
                 if (r.ReadBoolean())
+                {
                     BinaryConfiguration.CompactFooter = r.ReadBoolean();
+                }
+
+                if (r.ReadBoolean())
+                {
+                    BinaryConfiguration.NameMapper = BinaryBasicNameMapper.SimpleNameInstance;
+                }
             }
 
             // User attributes

http://git-wip-us.apache.org/repos/asf/ignite/blob/3e3b91a8/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Binary.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Binary.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Binary.cs
index fa7cf6c..4f3156c 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Binary.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Binary.cs
@@ -158,7 +158,7 @@ namespace Apache.Ignite.Core.Impl.Binary
 
             _marsh.PutBinaryType(desc);
 
-            return new BinaryEnum(GetTypeId(typeName), value, Marshaller);
+            return new BinaryEnum(desc.TypeId, value, Marshaller);
         }
 
         /** <inheritDoc /> */
@@ -166,8 +166,14 @@ namespace Apache.Ignite.Core.Impl.Binary
         {
             IgniteArgumentCheck.NotNull(type, "type");
             IgniteArgumentCheck.Ensure(type.IsEnum, "type", "Type should be an Enum.");
+            
+            var desc = Marshaller.GetDescriptor(type);
+
+            IgniteArgumentCheck.Ensure(desc.IsEnum, "typeName", "Type should be an Enum.");
+
+            _marsh.PutBinaryType(desc);
 
-            return BuildEnum(type.Name, value);
+            return new BinaryEnum(desc.TypeId, value, Marshaller);
         }
 
         /// <summary>