ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From voze...@apache.org
Subject [1/2] ignite git commit: IGNITE-1956: .Net part form Pavel.
Date Thu, 26 Nov 2015 13:57:34 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-1956 4b9b6c619 -> f421c53ab


http://git-wip-us.apache.org/repos/asf/ignite/blob/f421c53a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryWriter.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryWriter.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryWriter.cs
index c00dad6..25d9b98 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryWriter.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/BinaryWriter.cs
@@ -20,12 +20,12 @@ namespace Apache.Ignite.Core.Impl.Binary
     using System;
     using System.Collections;
     using System.Collections.Generic;
+    using System.Diagnostics;
     using System.IO;
     using Apache.Ignite.Core.Binary;
     using Apache.Ignite.Core.Impl.Binary.IO;
     using Apache.Ignite.Core.Impl.Binary.Metadata;
     using Apache.Ignite.Core.Impl.Binary.Structure;
-    using Apache.Ignite.Core.Impl.Common;
 
     /// <summary>
     /// Binary writer implementation.
@@ -45,7 +45,7 @@ namespace Apache.Ignite.Core.Impl.Binary
         private BinaryHandleDictionary<object, long> _hnds;
 
         /** Metadatas collected during this write session. */
-        private IDictionary<int, IBinaryType> _metas;
+        private IDictionary<int, BinaryType> _metas;
 
         /** Current type ID. */
         private int _curTypeId;
@@ -803,8 +803,28 @@ namespace Apache.Ignite.Core.Impl.Binary
         /// <param name="val">Enum value.</param>
         public void WriteEnum<T>(T val)
         {
-            _stream.WriteByte(BinaryUtils.TypeEnum);
-            BinaryUtils.WriteEnum(this, val);
+            if (val == null)
+                WriteNullField();
+            else
+            {
+                var desc = _marsh.GetDescriptor(val.GetType());
+
+                if (desc != null)
+                {
+                    var metaHnd = _marsh.GetBinaryTypeHandler(desc);
+
+                    _stream.WriteByte(BinaryUtils.TypeEnum);
+
+                    BinaryUtils.WriteEnum(this, val);
+
+                    SaveMetadata(desc, metaHnd.OnObjectWriteFinished());
+                }
+                else
+                {
+                    // Unregistered enum, write as serializable
+                    Write(new SerializableObjectHolder(val));
+                }
+            }
         }
 
         /// <summary>
@@ -817,10 +837,7 @@ namespace Apache.Ignite.Core.Impl.Binary
         {
             WriteFieldId(fieldName, BinaryUtils.TypeArrayEnum);
 
-            if (val == null)
-                WriteNullField();
-            else
-                WriteEnumArray0(val);
+            WriteEnumArray(val);
         }
 
         /// <summary>
@@ -830,24 +847,26 @@ namespace Apache.Ignite.Core.Impl.Binary
         /// <param name="val">Enum array.</param>
         public void WriteEnumArray<T>(T[] val)
         {
-            if (val == null)
-                WriteNullRawField();
-            else
-                WriteEnumArray0(val);
+            WriteEnumArrayInternal(val, null);
         }
 
         /// <summary>
         /// Writes the enum array.
         /// </summary>
         /// <param name="val">The value.</param>
-        private void WriteEnumArray0<T>(T[] val)
+        /// <param name="elementTypeId">The element type id.</param>
+        public void WriteEnumArrayInternal(Array val, int? elementTypeId)
         {
-            _stream.WriteByte(BinaryUtils.TypeArrayEnum);
+            if (val == null)
+                WriteNullField();
+            else
+            {
+                _stream.WriteByte(BinaryUtils.TypeArrayEnum);
 
-            // typeof(T) can yield wrong results (string[] is object[], for example)
-            var elementType = val.GetType().GetElementType();  
+                var elTypeId = elementTypeId ?? BinaryUtils.GetEnumTypeId(val.GetType().GetElementType(), Marshaller);
 
-            BinaryUtils.WriteArray(val, this, BinaryUtils.GetEnumTypeId(elementType, Marshaller));
+                BinaryUtils.WriteArray(val, this, elTypeId);
+            }
         }
 
         /// <summary>
@@ -1051,12 +1070,20 @@ namespace Apache.Ignite.Core.Impl.Binary
                 return;
             }
 
+            // Handle enums.
+            if (type.IsEnum)
+            {
+                WriteEnum(obj);
+
+                return;
+            }
+
             // Handle special case for builder.
             if (WriteBuilderSpecials(obj))
                 return;
 
             // Suppose that we faced normal object and perform descriptor lookup.
-            IBinaryTypeDescriptor desc = type.IsEnum ? null : _marsh.GetDescriptor(type);
+            IBinaryTypeDescriptor desc = _marsh.GetDescriptor(type);
 
             if (desc != null)
             {
@@ -1356,9 +1383,9 @@ namespace Apache.Ignite.Core.Impl.Binary
         /// Gets collected metadatas.
         /// </summary>
         /// <returns>Collected metadatas (if any).</returns>
-        internal IDictionary<int, IBinaryType> GetBinaryTypes()
+        internal ICollection<BinaryType> GetBinaryTypes()
         {
-            return _metas;
+            return _metas == null ? null : _metas.Values;
         }
 
         /// <summary>
@@ -1399,28 +1426,26 @@ namespace Apache.Ignite.Core.Impl.Binary
         /// <summary>
         /// Saves metadata for this session.
         /// </summary>
-        /// <param name="typeId">Type ID.</param>
-        /// <param name="typeName">Type name.</param>
-        /// <param name="affKeyFieldName">Affinity key field name.</param>
+        /// <param name="desc">The descriptor.</param>
         /// <param name="fields">Fields metadata.</param>
-        internal void SaveMetadata(int typeId, string typeName, string affKeyFieldName, IDictionary<string, int> fields)
+        internal void SaveMetadata(IBinaryTypeDescriptor desc, IDictionary<string, int> fields)
         {
+            Debug.Assert(desc != null);
+
             if (_metas == null)
             {
-                BinaryType meta =
-                    new BinaryType(typeId, typeName, fields, affKeyFieldName);
-
-                _metas = new Dictionary<int, IBinaryType>(1);
-
-                _metas[typeId] = meta;
+                _metas = new Dictionary<int, BinaryType>(1)
+                {
+                    {desc.TypeId, new BinaryType(desc, fields)}
+                };
             }
             else
             {
-                IBinaryType meta;
+                BinaryType meta;
 
-                if (_metas.TryGetValue(typeId, out meta))
+                if (_metas.TryGetValue(desc.TypeId, out meta))
                 {
-                    IDictionary<string, int> existingFields = ((BinaryType)meta).FieldsMap();
+                    IDictionary<string, int> existingFields = meta.GetFieldsMap();
 
                     foreach (KeyValuePair<string, int> field in fields)
                     {
@@ -1429,7 +1454,7 @@ namespace Apache.Ignite.Core.Impl.Binary
                     }
                 }
                 else
-                    _metas[typeId] = new BinaryType(typeId, typeName, fields, affKeyFieldName);
+                    _metas[desc.TypeId] = new BinaryType(desc, fields);
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/f421c53a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/IBinaryTypeDescriptor.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/IBinaryTypeDescriptor.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/IBinaryTypeDescriptor.cs
index 99af56d..e50279c 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/IBinaryTypeDescriptor.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/IBinaryTypeDescriptor.cs
@@ -30,74 +30,52 @@ namespace Apache.Ignite.Core.Impl.Binary
         /// <summary>
         /// Type.
         /// </summary>
-        Type Type
-        {
-            get;
-        }
+        Type Type { get; }
 
         /// <summary>
         /// Type ID.
         /// </summary>
-        int TypeId
-        {
-            get;
-        }
+        int TypeId { get; }
 
         /// <summary>
         /// Type name.
         /// </summary>
-        string TypeName
-        {
-            get;
-        }
+        string TypeName { get; }
 
         /// <summary>
         /// User type flag.
         /// </summary>
-        bool UserType
-        {
-            get;
-        }
+        bool UserType { get; }
 
         /// <summary>
         /// Whether to cache deserialized value in IBinaryObject
         /// </summary>
-        bool KeepDeserialized
-        {
-            get;
-        }
+        bool KeepDeserialized { get; }
 
         /// <summary>
         /// Name converter.
         /// </summary>
-        IBinaryNameMapper NameMapper
-        {
-            get;
-        }
+        IBinaryNameMapper NameMapper { get; }
 
         /// <summary>
         /// Mapper.
         /// </summary>
-        IBinaryIdMapper IdMapper
-        {
-            get;
-        }
+        IBinaryIdMapper IdMapper { get; }
 
         /// <summary>
         /// Serializer.
         /// </summary>
-        IBinarySerializer Serializer
-        {
-            get;
-        }
+        IBinarySerializer Serializer { get; }
 
         /// <summary>
         /// Affinity key field name.
         /// </summary>
-        string AffinityKeyFieldName
-        {
-            get;
-        }
+        string AffinityKeyFieldName { get; }
+
+        /// <summary>
+        /// Gets a value indicating whether this descriptor represents an enum type.
+        /// </summary>
+        bool IsEnum { get; }
 
         /// <summary>
         /// Write type structure.

http://git-wip-us.apache.org/repos/asf/ignite/blob/f421c53a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/IgniteBinary.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/IgniteBinary.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/IgniteBinary.cs
deleted file mode 100644
index ecc6807..0000000
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/IgniteBinary.cs
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- * 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;
-    using System.Collections.Generic;
-    using System.IO;
-    using Apache.Ignite.Core.Binary;
-    using Apache.Ignite.Core.Common;
-    using Apache.Ignite.Core.Impl.Binary.IO;
-    using Apache.Ignite.Core.Impl.Common;
-
-    /// <summary>
-    /// Binary implementation.
-    /// </summary>
-    internal class IgniteBinary : IIgniteBinary
-    {
-        /** Owning grid. */
-        private readonly Marshaller _marsh;
-
-        /// <summary>
-        /// Constructor.
-        /// </summary>
-        /// <param name="marsh">Marshaller.</param>
-        internal IgniteBinary(Marshaller marsh)
-        {
-            _marsh = marsh;
-        }
-
-        /** <inheritDoc /> */
-        public T ToBinary<T>(object obj)
-        {
-            if (obj is IBinaryObject)
-                return (T)obj;
-
-            IBinaryStream stream = new BinaryHeapStream(1024);
-
-            // Serialize.
-            BinaryWriter writer = _marsh.StartMarshal(stream);
-
-            try
-            {
-                writer.Write(obj);
-            }
-            finally
-            {
-                // Save metadata.
-                _marsh.FinishMarshal(writer);
-            }
-
-            // Deserialize.
-            stream.Seek(0, SeekOrigin.Begin);
-
-            return _marsh.Unmarshal<T>(stream, BinaryMode.ForceBinary);
-        }
-
-        /** <inheritDoc /> */
-        public IBinaryObjectBuilder GetBuilder(Type type)
-        {
-            IgniteArgumentCheck.NotNull(type, "type");
-
-            IBinaryTypeDescriptor desc = _marsh.GetDescriptor(type);
-
-            if (desc == null)
-                throw new IgniteException("Type is not binary (add it to BinaryConfiguration): " + 
-                    type.FullName);
-
-            return Builder0(null, BinaryFromDescriptor(desc), desc);
-        }
-
-        /** <inheritDoc /> */
-        public IBinaryObjectBuilder GetBuilder(string typeName)
-        {
-            IgniteArgumentCheck.NotNullOrEmpty(typeName, "typeName");
-
-            IBinaryTypeDescriptor desc = _marsh.GetDescriptor(typeName);
-            
-            return Builder0(null, BinaryFromDescriptor(desc), desc);
-        }
-
-        /** <inheritDoc /> */
-        public IBinaryObjectBuilder GetBuilder(IBinaryObject obj)
-        {
-            IgniteArgumentCheck.NotNull(obj, "obj");
-
-            BinaryObject obj0 = obj as BinaryObject;
-
-            if (obj0 == null)
-                throw new ArgumentException("Unsupported object type: " + obj.GetType());
-
-            IBinaryTypeDescriptor desc = _marsh.GetDescriptor(true, obj0.TypeId);
-            
-            return Builder0(null, obj0, desc);
-        }
-
-        /** <inheritDoc /> */
-        public int GetTypeId(string typeName)
-        {
-            IgniteArgumentCheck.NotNullOrEmpty(typeName, "typeName");
-
-            return Marshaller.GetDescriptor(typeName).TypeId;
-        }
-
-        /** <inheritDoc /> */
-        public ICollection<IBinaryType> GetBinaryTypes()
-        {
-            return Marshaller.Ignite.ClusterGroup.GetBinaryTypes();
-        }
-
-        /** <inheritDoc /> */
-        public IBinaryType GetBinaryType(int typeId)
-        {
-            return Marshaller.GetBinaryType(typeId);
-        }
-
-        /** <inheritDoc /> */
-        public IBinaryType GetBinaryType(string typeName)
-        {
-            IgniteArgumentCheck.NotNullOrEmpty(typeName, "typeName");
-
-            return GetBinaryType(GetTypeId(typeName));
-        }
-
-        /** <inheritDoc /> */
-        public IBinaryType GetBinaryType(Type type)
-        {
-            IgniteArgumentCheck.NotNull(type, "type");
-
-            var desc = Marshaller.GetDescriptor(type);
-
-            return desc == null ? null : Marshaller.GetBinaryType(desc.TypeId);
-        }
-
-        /// <summary>
-        /// Marshaller.
-        /// </summary>
-        internal Marshaller Marshaller
-        {
-            get
-            {
-                return _marsh;
-            }
-        }
-
-        /// <summary>
-        /// Create empty binary object from descriptor.
-        /// </summary>
-        /// <param name="desc">Descriptor.</param>
-        /// <returns>Empty binary object.</returns>
-        private BinaryObject BinaryFromDescriptor(IBinaryTypeDescriptor desc)
-        {
-            var len = BinaryObjectHeader.Size;
-
-            var hdr = new BinaryObjectHeader(desc.TypeId, 0, len, 0, len,
-                desc.UserType ? BinaryObjectHeader.Flag.UserType : BinaryObjectHeader.Flag.None);
-
-            var stream = new BinaryHeapStream(len);
-
-            BinaryObjectHeader.Write(hdr, stream, 0);
-
-            return new BinaryObject(_marsh, stream.InternalArray, 0, hdr);
-        }
-
-        /// <summary>
-        /// Internal builder creation routine.
-        /// </summary>
-        /// <param name="parent">Parent builder.</param>
-        /// <param name="obj">binary object.</param>
-        /// <param name="desc">Type descriptor.</param>
-        /// <returns>Builder.</returns>
-        private BinaryObjectBuilder Builder0(BinaryObjectBuilder parent, BinaryObject obj, 
-            IBinaryTypeDescriptor desc)
-        {
-            return new BinaryObjectBuilder(this, parent, obj, desc);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/f421c53a/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 251610e..457830f 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Marshaller.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Marshaller.cs
@@ -19,7 +19,7 @@ namespace Apache.Ignite.Core.Impl.Binary
 {
     using System;
     using System.Collections.Generic;
-    using System.Globalization;
+    using System.Diagnostics;
     using System.Linq;
     using Apache.Ignite.Core.Binary;
     using Apache.Ignite.Core.Impl.Binary.IO;
@@ -149,14 +149,14 @@ namespace Apache.Ignite.Core.Impl.Binary
         /// </summary>
         /// <param name="writer">Writer.</param>
         /// <returns>Dictionary with metadata.</returns>
-        public void FinishMarshal(IBinaryWriter writer)
+        public void FinishMarshal(BinaryWriter writer)
         {
-            var meta = ((BinaryWriter) writer).GetBinaryTypes();
+            var metas = writer.GetBinaryTypes();
 
             var ignite = Ignite;
 
-            if (ignite != null && meta != null && meta.Count > 0)
-                ignite.PutBinaryTypes(meta);
+            if (ignite != null && metas != null && metas.Count > 0)
+                ignite.PutBinaryTypes(metas);
         }
 
         /// <summary>
@@ -266,7 +266,22 @@ namespace Apache.Ignite.Core.Impl.Binary
                     return meta;
             }
 
-            return BinaryType.EmptyMeta;
+            return BinaryType.Empty;
+        }
+
+        /// <summary>
+        /// Puts the binary type metadata to Ignite.
+        /// </summary>
+        /// <param name="desc">Descriptor.</param>
+        /// <param name="fields">Fields.</param>
+        public void PutBinaryType(IBinaryTypeDescriptor desc, IDictionary<string, int> fields = null)
+        {
+            Debug.Assert(desc != null);
+
+            GetBinaryTypeHandler(desc);  // ensure that handler exists
+
+            if (Ignite != null)
+                Ignite.PutBinaryTypes(new[] {new BinaryType(desc, fields)});
         }
 
         /// <summary>
@@ -287,7 +302,7 @@ namespace Apache.Ignite.Core.Impl.Binary
                         IDictionary<int, BinaryTypeHolder> metas0 =
                             new Dictionary<int, BinaryTypeHolder>(_metas);
 
-                        holder = new BinaryTypeHolder(desc.TypeId, desc.TypeName, desc.AffinityKeyFieldName);
+                        holder = new BinaryTypeHolder(desc.TypeId, desc.TypeName, desc.AffinityKeyFieldName, desc.IsEnum);
 
                         metas0[desc.TypeId] = holder;
 
@@ -298,7 +313,7 @@ namespace Apache.Ignite.Core.Impl.Binary
 
             if (holder != null)
             {
-                ICollection<int> ids = holder.FieldIds();
+                ICollection<int> ids = holder.GetFieldIds();
 
                 bool newType = ids.Count == 0 && !holder.Saved();
 
@@ -312,23 +327,20 @@ namespace Apache.Ignite.Core.Impl.Binary
         /// Callback invoked when metadata has been sent to the server and acknowledged by it.
         /// </summary>
         /// <param name="newMetas">Binary types.</param>
-        public void OnBinaryTypesSent(IDictionary<int, IBinaryType> newMetas)
+        public void OnBinaryTypesSent(IEnumerable<BinaryType> newMetas)
         {
-            foreach (KeyValuePair<int, IBinaryType> metaEntry in newMetas)
+            foreach (var meta in newMetas)
             {
-                BinaryType meta = (BinaryType) metaEntry.Value;
-
-                IDictionary<int, Tuple<string, int>> mergeInfo =
-                    new Dictionary<int, Tuple<string, int>>(meta.FieldsMap().Count);
+                var mergeInfo = new Dictionary<int, Tuple<string, int>>(meta.GetFieldsMap().Count);
 
-                foreach (KeyValuePair<string, int> fieldMeta in meta.FieldsMap())
+                foreach (KeyValuePair<string, int> fieldMeta in meta.GetFieldsMap())
                 {
-                    int fieldId = BinaryUtils.FieldId(metaEntry.Key, fieldMeta.Key, null, null);
+                    int fieldId = BinaryUtils.FieldId(meta.TypeId, fieldMeta.Key, null, null);
 
                     mergeInfo[fieldId] = new Tuple<string, int>(fieldMeta.Key, fieldMeta.Value);
                 }
 
-                _metas[metaEntry.Key].Merge(mergeInfo);
+                _metas[meta.TypeId].Merge(mergeInfo);
             }
         }
         
@@ -396,7 +408,7 @@ namespace Apache.Ignite.Core.Impl.Binary
             if (type != null)
             {
                 // Type is found.
-                var typeName = GetTypeName(type);
+                var typeName = BinaryUtils.GetTypeName(type);
 
                 int typeId = BinaryUtils.TypeId(typeName, nameMapper, idMapper);
 
@@ -408,8 +420,15 @@ namespace Apache.Ignite.Core.Impl.Binary
                 if (refSerializer != null)
                     refSerializer.Register(type, typeId, nameMapper, idMapper);
 
+                if (typeCfg.IsEnum != type.IsEnum)
+                    throw new BinaryObjectException(
+                        string.Format(
+                            "Invalid IsEnum flag in binary type configuration. " +
+                            "Configuration value: IsEnum={0}, actual type: IsEnum={1}",
+                            typeCfg.IsEnum, type.IsEnum));
+
                 AddType(type, typeId, typeName, true, keepDeserialized, nameMapper, idMapper, serializer,
-                    typeCfg.AffinityKeyFieldName);
+                    typeCfg.AffinityKeyFieldName, type.IsEnum);
             }
             else
             {
@@ -419,7 +438,7 @@ namespace Apache.Ignite.Core.Impl.Binary
                 int typeId = BinaryUtils.TypeId(typeName, nameMapper, idMapper);
 
                 AddType(null, typeId, typeName, true, keepDeserialized, nameMapper, idMapper, null,
-                    typeCfg.AffinityKeyFieldName);
+                    typeCfg.AffinityKeyFieldName, typeCfg.IsEnum);
             }
         }
 
@@ -434,7 +453,7 @@ namespace Apache.Ignite.Core.Impl.Binary
                 ? BinarizableSerializer.Instance 
                 : null;
         }
-        
+
         /// <summary>
         /// Add type.
         /// </summary>
@@ -447,9 +466,10 @@ namespace Apache.Ignite.Core.Impl.Binary
         /// <param name="idMapper">ID mapper.</param>
         /// <param name="serializer">Serializer.</param>
         /// <param name="affKeyFieldName">Affinity key field name.</param>
+        /// <param name="isEnum">Enum flag.</param>
         private void AddType(Type type, int typeId, string typeName, bool userType, 
             bool keepDeserialized, IBinaryNameMapper nameMapper, IBinaryIdMapper idMapper,
-            IBinarySerializer serializer, string affKeyFieldName)
+            IBinarySerializer serializer, string affKeyFieldName, bool isEnum)
         {
             long typeKey = BinaryUtils.TypeKey(userType, typeId);
 
@@ -470,9 +490,8 @@ namespace Apache.Ignite.Core.Impl.Binary
             if (userType && _typeNameToDesc.ContainsKey(typeName))
                 throw new BinaryObjectException("Conflicting type name: " + typeName);
 
-            IBinaryTypeDescriptor descriptor =
-                new BinaryFullTypeDescriptor(type, typeId, typeName, userType, nameMapper, idMapper, serializer,
-                    keepDeserialized, affKeyFieldName);
+            var descriptor = new BinaryFullTypeDescriptor(type, typeId, typeName, userType, nameMapper, idMapper, 
+                serializer, keepDeserialized, affKeyFieldName, isEnum);
 
             if (type != null)
                 _typeToDesc[type] = descriptor;
@@ -492,7 +511,7 @@ namespace Apache.Ignite.Core.Impl.Binary
 
             var serializer = new BinarySystemTypeSerializer<T>(ctor);
 
-            AddType(type, typeId, GetTypeName(type), false, false, null, null, serializer, null);
+            AddType(type, typeId, BinaryUtils.GetTypeName(type), false, false, null, null, serializer, null, false);
         }
 
         /// <summary>
@@ -516,22 +535,5 @@ namespace Apache.Ignite.Core.Impl.Binary
             AddSystemType(BinaryUtils.TypeMessageListenerHolder, w => new MessageListenerHolder(w));
             AddSystemType(BinaryUtils.TypeStreamReceiverHolder, w => new StreamReceiverHolder(w));
         }
-
-        /// <summary>
-        /// Gets the 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>
-        private static string GetTypeName(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);
-        }
     }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/f421c53a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Metadata/BinaryType.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Metadata/BinaryType.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Metadata/BinaryType.cs
index a1a5eec..476e651 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Metadata/BinaryType.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Metadata/BinaryType.cs
@@ -27,9 +27,8 @@ namespace Apache.Ignite.Core.Impl.Binary.Metadata
     internal class BinaryType : IBinaryType
     {
         /** Empty metadata. */
-        [SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")]
-        public static readonly BinaryType EmptyMeta =
-            new BinaryType(BinaryUtils.TypeObject, BinaryTypeNames.TypeNameObject, null, null);
+        public static readonly BinaryType Empty =
+            new BinaryType(BinaryUtils.TypeObject, BinaryTypeNames.TypeNameObject, null, null, false);
 
         /** Empty dictionary. */
         private static readonly IDictionary<string, int> EmptyDict = new Dictionary<string, int>();
@@ -37,82 +36,74 @@ namespace Apache.Ignite.Core.Impl.Binary.Metadata
         /** Empty list. */
         private static readonly ICollection<string> EmptyList = new List<string>().AsReadOnly();
 
+        /** Type name map. */
+        private static readonly string[] TypeNames = new string[byte.MaxValue];
+
         /** Fields. */
         private readonly IDictionary<string, int> _fields;
 
+        /** Enum flag. */
+        private readonly bool _isEnum;
+
+        /** Type id. */
+        private readonly int _typeId;
+
+        /** Type name. */
+        private readonly string _typeName;
+
+        /** Aff key field name. */
+        private readonly string _affinityKeyFieldName;
+
+        /// <summary>
+        /// Initializes the <see cref="BinaryType"/> class.
+        /// </summary>
+        static BinaryType()
+        {
+            TypeNames[BinaryUtils.TypeBool] = BinaryTypeNames.TypeNameBool;
+            TypeNames[BinaryUtils.TypeByte] = BinaryTypeNames.TypeNameByte;
+            TypeNames[BinaryUtils.TypeShort] = BinaryTypeNames.TypeNameShort;
+            TypeNames[BinaryUtils.TypeChar] = BinaryTypeNames.TypeNameChar;
+            TypeNames[BinaryUtils.TypeInt] = BinaryTypeNames.TypeNameInt;
+            TypeNames[BinaryUtils.TypeLong] = BinaryTypeNames.TypeNameLong;
+            TypeNames[BinaryUtils.TypeFloat] = BinaryTypeNames.TypeNameFloat;
+            TypeNames[BinaryUtils.TypeDouble] = BinaryTypeNames.TypeNameDouble;
+            TypeNames[BinaryUtils.TypeDecimal] = BinaryTypeNames.TypeNameDecimal;
+            TypeNames[BinaryUtils.TypeString] = BinaryTypeNames.TypeNameString;
+            TypeNames[BinaryUtils.TypeGuid] = BinaryTypeNames.TypeNameGuid;
+            TypeNames[BinaryUtils.TypeTimestamp] = BinaryTypeNames.TypeNameTimestamp;
+            TypeNames[BinaryUtils.TypeEnum] = BinaryTypeNames.TypeNameEnum;
+            TypeNames[BinaryUtils.TypeObject] = BinaryTypeNames.TypeNameObject;
+            TypeNames[BinaryUtils.TypeArrayBool] = BinaryTypeNames.TypeNameArrayBool;
+            TypeNames[BinaryUtils.TypeArrayByte] = BinaryTypeNames.TypeNameArrayByte;
+            TypeNames[BinaryUtils.TypeArrayShort] = BinaryTypeNames.TypeNameArrayShort;
+            TypeNames[BinaryUtils.TypeArrayChar] = BinaryTypeNames.TypeNameArrayChar;
+            TypeNames[BinaryUtils.TypeArrayInt] = BinaryTypeNames.TypeNameArrayInt;
+            TypeNames[BinaryUtils.TypeArrayLong] = BinaryTypeNames.TypeNameArrayLong;
+            TypeNames[BinaryUtils.TypeArrayFloat] = BinaryTypeNames.TypeNameArrayFloat;
+            TypeNames[BinaryUtils.TypeArrayDouble] = BinaryTypeNames.TypeNameArrayDouble;
+            TypeNames[BinaryUtils.TypeArrayDecimal] = BinaryTypeNames.TypeNameArrayDecimal;
+            TypeNames[BinaryUtils.TypeArrayString] = BinaryTypeNames.TypeNameArrayString;
+            TypeNames[BinaryUtils.TypeArrayGuid] = BinaryTypeNames.TypeNameArrayGuid;
+            TypeNames[BinaryUtils.TypeArrayTimestamp] = BinaryTypeNames.TypeNameArrayTimestamp;
+            TypeNames[BinaryUtils.TypeArrayEnum] = BinaryTypeNames.TypeNameArrayEnum;
+            TypeNames[BinaryUtils.TypeArray] = BinaryTypeNames.TypeNameArrayObject;
+            TypeNames[BinaryUtils.TypeCollection] = BinaryTypeNames.TypeNameCollection;
+            TypeNames[BinaryUtils.TypeDictionary] = BinaryTypeNames.TypeNameMap;
+        }
+
         /// <summary>
         /// Get type name by type ID.
         /// </summary>
         /// <param name="typeId">Type ID.</param>
         /// <returns>Type name.</returns>
-        private static string ConvertTypeName(int typeId)
+        private static string GetTypeName(int typeId)
         {
-            switch (typeId)
-            {
-                case BinaryUtils.TypeBool:
-                    return BinaryTypeNames.TypeNameBool;
-                case BinaryUtils.TypeByte:
-                    return BinaryTypeNames.TypeNameByte;
-                case BinaryUtils.TypeShort:
-                    return BinaryTypeNames.TypeNameShort;
-                case BinaryUtils.TypeChar:
-                    return BinaryTypeNames.TypeNameChar;
-                case BinaryUtils.TypeInt:
-                    return BinaryTypeNames.TypeNameInt;
-                case BinaryUtils.TypeLong:
-                    return BinaryTypeNames.TypeNameLong;
-                case BinaryUtils.TypeFloat:
-                    return BinaryTypeNames.TypeNameFloat;
-                case BinaryUtils.TypeDouble:
-                    return BinaryTypeNames.TypeNameDouble;
-                case BinaryUtils.TypeDecimal:
-                    return BinaryTypeNames.TypeNameDecimal;
-                case BinaryUtils.TypeString:
-                    return BinaryTypeNames.TypeNameString;
-                case BinaryUtils.TypeGuid:
-                    return BinaryTypeNames.TypeNameGuid;
-                case BinaryUtils.TypeTimestamp:
-                    return BinaryTypeNames.TypeNameTimestamp;
-                case BinaryUtils.TypeEnum:
-                    return BinaryTypeNames.TypeNameEnum;
-                case BinaryUtils.TypeBinary:
-                case BinaryUtils.TypeObject:
-                    return BinaryTypeNames.TypeNameObject;
-                case BinaryUtils.TypeArrayBool:
-                    return BinaryTypeNames.TypeNameArrayBool;
-                case BinaryUtils.TypeArrayByte:
-                    return BinaryTypeNames.TypeNameArrayByte;
-                case BinaryUtils.TypeArrayShort:
-                    return BinaryTypeNames.TypeNameArrayShort;
-                case BinaryUtils.TypeArrayChar:
-                    return BinaryTypeNames.TypeNameArrayChar;
-                case BinaryUtils.TypeArrayInt:
-                    return BinaryTypeNames.TypeNameArrayInt;
-                case BinaryUtils.TypeArrayLong:
-                    return BinaryTypeNames.TypeNameArrayLong;
-                case BinaryUtils.TypeArrayFloat:
-                    return BinaryTypeNames.TypeNameArrayFloat;
-                case BinaryUtils.TypeArrayDouble:
-                    return BinaryTypeNames.TypeNameArrayDouble;
-                case BinaryUtils.TypeArrayDecimal:
-                    return BinaryTypeNames.TypeNameArrayDecimal;
-                case BinaryUtils.TypeArrayString:
-                    return BinaryTypeNames.TypeNameArrayString;
-                case BinaryUtils.TypeArrayGuid:
-                    return BinaryTypeNames.TypeNameArrayGuid;
-                case BinaryUtils.TypeArrayTimestamp:
-                    return BinaryTypeNames.TypeNameArrayTimestamp;
-                case BinaryUtils.TypeArrayEnum:
-                    return BinaryTypeNames.TypeNameArrayEnum;
-                case BinaryUtils.TypeArray:
-                    return BinaryTypeNames.TypeNameArrayObject;
-                case BinaryUtils.TypeCollection:
-                    return BinaryTypeNames.TypeNameCollection;
-                case BinaryUtils.TypeDictionary:
-                    return BinaryTypeNames.TypeNameMap;
-                default:
-                    throw new BinaryObjectException("Invalid type ID: " + typeId);
-            }
+            var typeName = (typeId >= 0 && typeId < TypeNames.Length) ? TypeNames[typeId] : null;
+
+            if (typeName != null)
+                return typeName;
+
+            throw new BinaryObjectException("Invalid type ID: " + typeId);
         }
 
         /// <summary>
@@ -121,12 +112,22 @@ namespace Apache.Ignite.Core.Impl.Binary.Metadata
         /// <param name="reader">The reader.</param>
         public BinaryType(IBinaryRawReader reader)
         {
-            TypeId = reader.ReadInt();
-            TypeName = reader.ReadString();
-            AffinityKeyFieldName = reader.ReadString();
+            _typeId = reader.ReadInt();
+            _typeName = reader.ReadString();
+            _affinityKeyFieldName = reader.ReadString();
             _fields = reader.ReadDictionaryAsGeneric<string, int>();
+            _isEnum = reader.ReadBoolean();
+        }
 
-            reader.ReadBoolean();
+        /// <summary>
+        /// Initializes a new instance of the <see cref="BinaryType"/> class.
+        /// </summary>
+        /// <param name="desc">Descriptor.</param>
+        /// <param name="fields">Fields.</param>
+        public BinaryType(IBinaryTypeDescriptor desc, IDictionary<string, int> fields = null) 
+            : this (desc.TypeId, desc.TypeName, fields, desc.AffinityKeyFieldName, desc.IsEnum)
+        {
+            // No-op.
         }
 
         /// <summary>
@@ -136,25 +137,33 @@ namespace Apache.Ignite.Core.Impl.Binary.Metadata
         /// <param name="typeName">Type name.</param>
         /// <param name="fields">Fields.</param>
         /// <param name="affKeyFieldName">Affinity key field name.</param>
+        /// <param name="isEnum">Enum flag.</param>
         public BinaryType(int typeId, string typeName, IDictionary<string, int> fields,
-            string affKeyFieldName)
+            string affKeyFieldName, bool isEnum)
         {
-            TypeId = typeId;
-            TypeName = typeName;
-            AffinityKeyFieldName = affKeyFieldName;
+            _typeId = typeId;
+            _typeName = typeName;
+            _affinityKeyFieldName = affKeyFieldName;
             _fields = fields;
+            _isEnum = isEnum;
         }
 
         /// <summary>
         /// Type ID.
         /// </summary>
         /// <returns></returns>
-        public int TypeId { get; private set; }
+        public int TypeId
+        {
+            get { return _typeId; }
+        }
 
         /// <summary>
         /// Gets type name.
         /// </summary>
-        public string TypeName { get; private set; }
+        public string TypeName
+        {
+            get { return _typeName; }
+        }
 
         /// <summary>
         /// Gets field names for that type.
@@ -179,7 +188,7 @@ namespace Apache.Ignite.Core.Impl.Binary.Metadata
 
                 _fields.TryGetValue(fieldName, out typeId);
 
-                return ConvertTypeName(typeId);
+                return GetTypeName(typeId);
             }
             
             return null;
@@ -188,13 +197,22 @@ namespace Apache.Ignite.Core.Impl.Binary.Metadata
         /// <summary>
         /// Gets optional affinity key field name.
         /// </summary>
-        public string AffinityKeyFieldName { get; private set; }
+        public string AffinityKeyFieldName
+        {
+            get { return _affinityKeyFieldName; }
+        }
+
+        /** <inheritdoc /> */
+        public bool IsEnum
+        {
+            get { return _isEnum; }
+        }
 
         /// <summary>
         /// Gets fields map.
         /// </summary>
         /// <returns>Fields map.</returns>
-        public IDictionary<string, int> FieldsMap()
+        public IDictionary<string, int> GetFieldsMap()
         {
             return _fields ?? EmptyDict;
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/f421c53a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Metadata/BinaryTypeHolder.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Metadata/BinaryTypeHolder.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Metadata/BinaryTypeHolder.cs
index 524cda9..53ad77e 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Metadata/BinaryTypeHolder.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Metadata/BinaryTypeHolder.cs
@@ -19,7 +19,6 @@ namespace Apache.Ignite.Core.Impl.Binary.Metadata
 {
     using System;
     using System.Collections.Generic;
-    using Apache.Ignite.Core.Binary;
 
     /// <summary>
     /// Metadata for particular type.
@@ -35,11 +34,11 @@ namespace Apache.Ignite.Core.Impl.Binary.Metadata
         /** Affinity key field name. */
         private readonly string _affKeyFieldName;
 
-        /** Empty metadata when nothig is know about object fields yet. */
-        private readonly IBinaryType _emptyMeta;
+        /** Enum flag. */
+        private readonly bool _isEnum;
 
         /** Collection of know field IDs. */
-        private volatile ICollection<int> _ids;
+        private volatile HashSet<int> _ids;
 
         /** Last known unmodifiable metadata which is given to the user. */
         private volatile BinaryType _meta;
@@ -47,19 +46,19 @@ namespace Apache.Ignite.Core.Impl.Binary.Metadata
         /** Saved flag (set if type metadata was saved at least once). */
         private volatile bool _saved;
 
+
         /// <summary>
         /// Constructor.
         /// </summary>
         /// <param name="typeId">Type ID.</param>
         /// <param name="typeName">Type name.</param>
         /// <param name="affKeyFieldName">Affinity key field name.</param>
-        public BinaryTypeHolder(int typeId, string typeName, string affKeyFieldName)
+        public BinaryTypeHolder(int typeId, string typeName, string affKeyFieldName, bool isEnum)
         {
             _typeId = typeId;
             _typeName = typeName;
             _affKeyFieldName = affKeyFieldName;
-
-            _emptyMeta = new BinaryType(typeId, typeName, null, affKeyFieldName);
+            _isEnum = isEnum;
         }
 
         /// <summary>
@@ -72,21 +71,12 @@ namespace Apache.Ignite.Core.Impl.Binary.Metadata
         }
 
         /// <summary>
-        /// Get current type metadata.
-        /// </summary>
-        /// <value>Type metadata.</value>
-        public IBinaryType BinaryType
-        {
-            get { return _meta ?? _emptyMeta; }
-        }
-
-        /// <summary>
         /// Currently cached field IDs.
         /// </summary>
         /// <returns>Cached field IDs.</returns>
-        public ICollection<int> FieldIds()
+        public ICollection<int> GetFieldIds()
         {
-            ICollection<int> ids0 = _ids;
+            var ids0 = _ids;
 
             if (_ids == null)
             {
@@ -120,13 +110,13 @@ namespace Apache.Ignite.Core.Impl.Binary.Metadata
             lock (this)
             {
                 // 1. Create copies of the old meta.
-                ICollection<int> ids0 = _ids;
+                var ids0 = _ids;
                 BinaryType meta0 = _meta;
 
-                ICollection<int> newIds = ids0 != null ? new HashSet<int>(ids0) : new HashSet<int>();
+                var newIds = ids0 != null ? new HashSet<int>(ids0) : new HashSet<int>();
 
                 IDictionary<string, int> newFields = meta0 != null ?
-                    new Dictionary<string, int>(meta0.FieldsMap()) : new Dictionary<string, int>(newMap.Count);
+                    new Dictionary<string, int>(meta0.GetFieldsMap()) : new Dictionary<string, int>(newMap.Count);
 
                 // 2. Add new fields.
                 foreach (KeyValuePair<int, Tuple<string, int>> newEntry in newMap)
@@ -139,7 +129,7 @@ namespace Apache.Ignite.Core.Impl.Binary.Metadata
                 }
 
                 // 3. Assign new meta. Order is important here: meta must be assigned before field IDs.
-                _meta = new BinaryType(_typeId, _typeName, newFields, _affKeyFieldName);
+                _meta = new BinaryType(_typeId, _typeName, newFields, _affKeyFieldName, _isEnum);
                 _ids = newIds;
             }
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/f421c53a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Structure/BinaryStructureTracker.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Structure/BinaryStructureTracker.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Structure/BinaryStructureTracker.cs
index 37d980e..af1b050 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Structure/BinaryStructureTracker.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Structure/BinaryStructureTracker.cs
@@ -111,7 +111,7 @@ namespace Apache.Ignite.Core.Impl.Binary.Structure
                     var meta = metaHnd.OnObjectWriteFinished();
 
                     if (meta != null)
-                        writer.SaveMetadata(_desc.TypeId, _desc.TypeName, _desc.AffinityKeyFieldName, meta);
+                        writer.SaveMetadata(_desc, meta);
                 }
             }
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/f421c53a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs
index ded671a..2fcada3 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs
@@ -31,6 +31,7 @@ namespace Apache.Ignite.Core.Impl
     using Apache.Ignite.Core.DataStructures;
     using Apache.Ignite.Core.Events;
     using Apache.Ignite.Core.Impl.Binary;
+    using Apache.Ignite.Core.Impl.Binary.Metadata;
     using Apache.Ignite.Core.Impl.Cache;
     using Apache.Ignite.Core.Impl.Cluster;
     using Apache.Ignite.Core.Impl.Common;
@@ -66,7 +67,7 @@ namespace Apache.Ignite.Core.Impl
         private readonly ClusterGroupImpl _prj;
 
         /** Binary. */
-        private readonly IgniteBinary _igniteBinary;
+        private readonly Binary.Binary _binary;
 
         /** Cached proxy. */
         private readonly IgniteProxy _proxy;
@@ -117,7 +118,7 @@ namespace Apache.Ignite.Core.Impl
 
             _prj = new ClusterGroupImpl(proc, UU.ProcessorProjection(proc), marsh, this, null);
 
-            _igniteBinary = new IgniteBinary(marsh);
+            _binary = new Binary.Binary(marsh);
 
             _proxy = new IgniteProxy(this);
 
@@ -394,9 +395,9 @@ namespace Apache.Ignite.Core.Impl
         }
 
         /** <inheritdoc /> */
-        public IIgniteBinary GetBinary()
+        public IBinary GetBinary()
         {
-            return _igniteBinary;
+            return _binary;
         }
 
         /** <inheritdoc /> */
@@ -472,7 +473,7 @@ namespace Apache.Ignite.Core.Impl
         /// Put metadata to Grid.
         /// </summary>
         /// <param name="metas">Metadata.</param>
-        internal void PutBinaryTypes(IDictionary<int, IBinaryType> metas)
+        internal void PutBinaryTypes(ICollection<BinaryType> metas)
         {
             _prj.PutBinaryTypes(metas);
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/f421c53a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IgniteProxy.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IgniteProxy.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IgniteProxy.cs
index 113f700..36aac1a 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IgniteProxy.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/IgniteProxy.cs
@@ -275,7 +275,7 @@ namespace Apache.Ignite.Core.Impl
         }
 
         /** <inheritdoc /> */
-        public IIgniteBinary GetBinary()
+        public IBinary GetBinary()
         {
             return _ignite.GetBinary();
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/f421c53a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/PlatformTarget.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/PlatformTarget.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/PlatformTarget.cs
index aeca403..4a4f93b 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/PlatformTarget.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/PlatformTarget.cs
@@ -23,7 +23,6 @@ namespace Apache.Ignite.Core.Impl
     using System.Diagnostics.CodeAnalysis;
     using System.IO;
     using System.Threading.Tasks;
-    using Apache.Ignite.Core.Binary;
     using Apache.Ignite.Core.Impl.Binary;
     using Apache.Ignite.Core.Impl.Binary.IO;
     using Apache.Ignite.Core.Impl.Binary.Metadata;
@@ -581,7 +580,7 @@ namespace Apache.Ignite.Core.Impl
         /// Put binary types to Grid.
         /// </summary>
         /// <param name="types">Binary types.</param>
-        internal void PutBinaryTypes(IDictionary<int, IBinaryType> types)
+        internal void PutBinaryTypes(ICollection<BinaryType> types)
         {
             DoOutOp(OpMeta, stream =>
             {
@@ -589,15 +588,15 @@ namespace Apache.Ignite.Core.Impl
 
                 metaWriter.WriteInt(types.Count);
 
-                foreach (var meta in types.Values)
+                foreach (var meta in types)
                 {
-                    BinaryType meta0 = (BinaryType)meta;
+                    BinaryType meta0 = meta;
 
                     metaWriter.WriteInt(meta0.TypeId);
                     metaWriter.WriteString(meta0.TypeName);
                     metaWriter.WriteString(meta0.AffinityKeyFieldName);
 
-                    IDictionary<string, int> fields = meta0.FieldsMap();
+                    IDictionary<string, int> fields = meta0.GetFieldsMap();
 
                     metaWriter.WriteInt(fields.Count);
 
@@ -607,7 +606,7 @@ namespace Apache.Ignite.Core.Impl
                         metaWriter.WriteInt(field.Value);
                     }
 
-                    metaWriter.WriteBoolean(false);
+                    metaWriter.WriteBoolean(meta.IsEnum);
                 }
 
                 _marsh.FinishMarshal(metaWriter);

http://git-wip-us.apache.org/repos/asf/ignite/blob/f421c53a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Transactions/TransactionsImpl.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Transactions/TransactionsImpl.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Transactions/TransactionsImpl.cs
index a27bffe..0bc7172 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Transactions/TransactionsImpl.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Transactions/TransactionsImpl.cs
@@ -67,8 +67,8 @@ namespace Apache.Ignite.Core.Impl.Transactions
             {
                 var reader = marsh.StartUnmarshal(stream).GetRawReader();
 
-                concurrency = reader.ReadEnum<TransactionConcurrency>();
-                isolation = reader.ReadEnum<TransactionIsolation>();
+                concurrency = (TransactionConcurrency) reader.ReadInt();
+                isolation = (TransactionIsolation) reader.ReadInt();
                 timeout = TimeSpan.FromMilliseconds(reader.ReadLong());
             });
 


Mime
View raw message