You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by vo...@apache.org on 2015/11/11 10:14:54 UTC

[12/25] ignite git commit: IGNITE-1845: Adopted new binary API in .Net.

http://git-wip-us.apache.org/repos/asf/ignite/blob/894057e5/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/SerializableObjectHolder.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/SerializableObjectHolder.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/SerializableObjectHolder.cs
new file mode 100644
index 0000000..2da854f
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/SerializableObjectHolder.cs
@@ -0,0 +1,73 @@
+/*
+ * 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.Diagnostics;
+    using System.Runtime.Serialization.Formatters.Binary;
+    using Apache.Ignite.Core.Binary;
+    using Apache.Ignite.Core.Impl.Binary.IO;
+
+    /// <summary>
+    /// Wraps Serializable item in a binarizable.
+    /// </summary>
+    internal class SerializableObjectHolder : IBinaryWriteAware
+    {
+        /** */
+        private readonly object _item;
+
+        /// <summary>
+        /// Initializes a new instance of the <see cref="SerializableObjectHolder"/> class.
+        /// </summary>
+        /// <param name="item">The item to wrap.</param>
+        public SerializableObjectHolder(object item)
+        {
+            _item = item;
+        }
+
+        /// <summary>
+        /// Gets the item to wrap.
+        /// </summary>
+        public object Item
+        {
+            get { return _item; }
+        }
+
+        /** <inheritDoc /> */
+        public void WriteBinary(IBinaryWriter writer)
+        {
+            Debug.Assert(writer != null);
+
+            var writer0 = (BinaryWriter)writer.GetRawWriter();
+
+            writer0.WithDetach(w => new BinaryFormatter().Serialize(new BinaryStreamAdapter(w.Stream), Item));
+        }
+
+        /// <summary>
+        /// Initializes a new instance of the <see cref="SerializableObjectHolder"/> class.
+        /// </summary>
+        /// <param name="reader">The reader.</param>
+        public SerializableObjectHolder(IBinaryReader reader)
+        {
+            Debug.Assert(reader != null);
+
+            var reader0 = (BinaryReader) reader.GetRawReader();
+
+            _item = new BinaryFormatter().Deserialize(new BinaryStreamAdapter(reader0.Stream), null);
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/894057e5/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Structure/BinaryStructure.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Structure/BinaryStructure.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Structure/BinaryStructure.cs
new file mode 100644
index 0000000..3c97877
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Structure/BinaryStructure.cs
@@ -0,0 +1,332 @@
+/*
+ * 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.Structure
+{
+    using System;
+    using System.Collections.Generic;
+    using System.Diagnostics;
+    using Apache.Ignite.Core.Binary;
+
+    /// <summary>
+    /// Binary type structure. Cache field IDs and metadata to improve marshalling performance.
+    /// Every object write contains a set of field writes. Every unique ordered set of written fields
+    /// produce write "path". We cache these paths allowing for very fast traverse over object structure
+    /// without expensive map lookups and field ID calculations. 
+    /// </summary>
+    internal class BinaryStructure
+    {
+        /// <summary>
+        /// Create empty type structure.
+        /// </summary>
+        /// <returns>Empty type structure.</returns>
+        public static BinaryStructure CreateEmpty()
+        {
+            return new BinaryStructure(new[] { new BinaryStructureEntry[0] }, 
+                new BinaryStructureJumpTable[1], new Dictionary<string, byte>());
+        }
+
+        /** Entries. */
+        private readonly BinaryStructureEntry[][] _paths;
+
+        /** Jumps. */
+        private readonly BinaryStructureJumpTable[] _jumps;
+
+        /** Field types. */
+        private readonly IDictionary<string, byte> _fieldTypes;
+
+        /// <summary>
+        /// Constructor.
+        /// </summary>
+        /// <param name="paths">Paths.</param>
+        /// <param name="jumps">Jumps.</param>
+        /// <param name="fieldTypes">Field types.</param>
+        private BinaryStructure(BinaryStructureEntry[][] paths,
+            BinaryStructureJumpTable[] jumps, IDictionary<string, byte> fieldTypes)
+        {
+            _paths = paths;
+            _jumps = jumps;
+            _fieldTypes = fieldTypes;
+        }
+
+        /// <summary>
+        /// Gets field ID if possible.
+        /// </summary>
+        /// <param name="fieldName">Field name.</param>
+        /// <param name="fieldType">Field type.</param>
+        /// <param name="pathIdx">Path index, changes during jumps.</param>
+        /// <param name="actionIdx">Action index.</param>
+        /// <returns>Field ID or zero in case there are no matching path.</returns>
+        public int GetFieldId(string fieldName, byte fieldType, ref int pathIdx, int actionIdx)
+        {
+            Debug.Assert(pathIdx <= _paths.Length);
+
+            // Get path.
+            BinaryStructureEntry[] path = _paths[pathIdx];
+
+            if (actionIdx < path.Length)
+            {
+                // Get entry matching the action index.
+                BinaryStructureEntry entry = path[actionIdx];
+
+                if (entry.IsExpected(fieldName, fieldType))
+                    // Entry matches our expectations, return.
+                    return entry.Id;
+                else if (entry.IsJumpTable)
+                {
+                    // Entry is a pointer to a jump table.
+                    Debug.Assert(entry.Id < _jumps.Length);
+
+                    BinaryStructureJumpTable jmpTbl = _jumps[entry.Id];
+
+                    int pathIdx0 = jmpTbl.GetPathIndex(fieldName);
+
+                    if (pathIdx0 < 0)
+                        return 0;
+
+                    Debug.Assert(pathIdx0 < _paths.Length);
+
+                    entry = _paths[pathIdx0][actionIdx];
+
+                    entry.ValidateType(fieldType);
+
+                    pathIdx = pathIdx0;
+
+                    return entry.Id;
+                }
+            }
+
+            // Failed to find anything because this is a new field.
+            return 0;
+        }
+
+        /// <summary>
+        /// Merge updates into a new type structure.
+        /// </summary>
+        /// <param name="exp">Expected type structure to apply updates to </param>
+        /// <param name="pathIdx">Path index.</param>
+        /// <param name="updates">Updates.</param>
+        /// <returns>New type structure with updates.</returns>
+        public BinaryStructure Merge(BinaryStructure exp, int pathIdx, 
+            IList<BinaryStructureUpdate> updates)
+        {
+            if (updates.Count == 0)
+                return this;
+
+            // Algorithm ensures that updates are applied to the same type structure,
+            // where they were initially observed. This allow us to keep structure
+            // internals simpler and more efficient. On the other hand, this imposes
+            // some performance hit because in case of concurrent update, recorded
+            // changes will be discarded and recorded again during the next write
+            // on the same path. This should occur only during application warmup.
+
+            // Note that field types are merged anyway to avoid metadata clashes.
+            BinaryStructure res = MergeFieldTypes(updates);
+
+            if (ReferenceEquals(exp, this))
+            {
+                BinaryStructureUpdate firstUpdate = updates[0];
+
+                if (firstUpdate.Index == 0)
+                {
+                    // Special case: the very first structure update. Simply attach all updates.
+                    Debug.Assert(_paths.Length == 1);
+                    Debug.Assert(_paths[0].Length == 0);
+                    Debug.Assert(pathIdx == 0);
+
+                    var newPaths = CopyPaths(updates.Count, 0);
+
+                    ApplyUpdatesToPath(newPaths[0], updates);
+
+                    res = new BinaryStructure(newPaths, _jumps, res._fieldTypes);
+                }
+                else
+                {
+                    // Get entry where updates should start.
+                    BinaryStructureEntry[] path = _paths[pathIdx];
+
+                    BinaryStructureEntry startEntry = default(BinaryStructureEntry);
+
+                    if (firstUpdate.Index < path.Length)
+                        startEntry = path[firstUpdate.Index];
+
+                    if (startEntry.IsEmpty)
+                    {
+                        // We are on the empty/non-existent entry. Continue the path without branching.
+                        var newPaths = CopyPaths(firstUpdate.Index + updates.Count, 0);
+
+                        ApplyUpdatesToPath(newPaths[pathIdx], updates);
+
+                        res = new BinaryStructure(newPaths, _jumps, res._fieldTypes);
+                    }
+                    else if (startEntry.IsJumpTable)
+                    {
+                        // We are on the jump table. Add a new path and record it in the jump table.
+
+                        // 1. Prepare new structures.
+                        var newPaths = CopyPaths(firstUpdate.Index + updates.Count, 1);
+                        var newJumps = CopyJumps(0);
+
+                        // New path will be the last one.
+                        int newPathIdx = newPaths.Length - 1;
+
+                        // Apply updates to the new path.
+                        ApplyUpdatesToPath(newPaths[newPathIdx], updates);
+
+                        // Add the jump to the table.
+                        newJumps[startEntry.Id] = 
+                            newJumps[startEntry.Id].CopyAndAdd(firstUpdate.FieldName, newPathIdx);
+
+                        res = new BinaryStructure(newPaths, newJumps, res._fieldTypes);
+                    }
+                    else
+                    {
+                        // We are on existing entry. Need to create a new jump table here and two new paths.
+
+                        // 1. Prepaare new structures.
+                        var newPaths = CopyPaths(firstUpdate.Index + updates.Count, 2);
+                        var newJumps = CopyJumps(1);
+
+                        // Old path will be moved here.
+                        int oldPathIdx = newPaths.Length - 2;
+
+                        // New path will reside here.
+                        int newPathIdx = newPaths.Length - 1;
+
+                        // Create new jump table.
+                        int newJumpIdx = newJumps.Length - 1;
+
+                        newJumps[newJumpIdx] = new BinaryStructureJumpTable(startEntry.Name, oldPathIdx,
+                            firstUpdate.FieldName, newPathIdx);
+
+                        // Re-create old path in two steps: move old path to the new place, then clean the old path.
+                        for (int i = firstUpdate.Index; i < path.Length; i++)
+                        {
+                            newPaths[oldPathIdx][i] = newPaths[pathIdx][i];
+
+                            if (i == firstUpdate.Index)
+                                // Inject jump table ...
+                                newPaths[pathIdx][i] = new BinaryStructureEntry(newJumpIdx);
+                            else
+                                // ... or just reset.
+                                newPaths[pathIdx][i] = new BinaryStructureEntry();
+                        }
+
+                        // Apply updates to the new path.
+                        ApplyUpdatesToPath(newPaths[newPaths.Length - 1], updates);
+
+                        res = new BinaryStructure(newPaths, newJumps, res._fieldTypes);
+                    }
+
+                }
+            }
+
+            return res;
+        }
+
+        /// <summary>
+        /// Copy and possibly expand paths.
+        /// </summary>
+        /// <param name="minLen">Minimum length.</param>
+        /// <param name="additionalPaths">Amount of additional paths required.</param>
+        /// <returns>Result.</returns>
+        private BinaryStructureEntry[][] CopyPaths(int minLen, int additionalPaths)
+        {
+            var newPaths = new BinaryStructureEntry[_paths.Length + additionalPaths][];
+
+            int newPathLen = Math.Max(_paths[0].Length, minLen);
+
+            for (int i = 0; i < newPaths.Length; i++)
+            {
+                newPaths[i] = new BinaryStructureEntry[newPathLen];
+
+                if (i < _paths.Length)
+                    Array.Copy(_paths[i], newPaths[i], _paths[i].Length);
+            }
+
+            return newPaths;
+        }
+
+        /// <summary>
+        /// Copy and possibly expand jump tables.
+        /// </summary>
+        /// <param name="additionalJumps">Amount of additional jumps required.</param>
+        /// <returns>Result.</returns>
+        private BinaryStructureJumpTable[] CopyJumps(int additionalJumps)
+        {
+            var newJumps = new BinaryStructureJumpTable[_jumps.Length + additionalJumps];
+
+            // The very first jump is always null so that we can distinguish between jump table
+            // and empty value in BinaryStructureEntry.
+            for (int i = 1; i < _jumps.Length; i++)
+                newJumps[i] = _jumps[i].Copy();
+
+            return newJumps;
+        }
+
+        /// <summary>
+        /// Apply updates to path.
+        /// </summary>
+        /// <param name="path">Path.</param>
+        /// <param name="updates">Updates.</param>
+        private static void ApplyUpdatesToPath(IList<BinaryStructureEntry> path,
+            IEnumerable<BinaryStructureUpdate> updates)
+        {
+            foreach (var u in updates)
+                path[u.Index] = new BinaryStructureEntry(u.FieldName, u.FieldId, u.FieldType);
+        }
+
+        /// <summary>
+        /// Merge field types.
+        /// </summary>
+        /// <param name="updates">Updates.</param>
+        /// <returns>Type structure with applied updates.</returns>
+        private BinaryStructure MergeFieldTypes(IList<BinaryStructureUpdate> updates)
+        {
+            IDictionary<string, byte> newFieldTypes = new Dictionary<string, byte>(_fieldTypes);
+
+            foreach (BinaryStructureUpdate update in updates)
+            {
+                byte expType;
+
+                if (_fieldTypes.TryGetValue(update.FieldName, out expType))
+                {
+                    // This is an old field.
+                    if (expType != update.FieldType)
+                    {
+                        throw new BinaryObjectException("Field type mismatch detected [fieldName=" + update.FieldName +
+                            ", expectedType=" + expType + ", actualType=" + update.FieldType + ']');
+                    }
+                }
+                else
+                    // This is a new field.
+                    newFieldTypes[update.FieldName] = update.FieldType;
+            }
+
+            return newFieldTypes.Count == _fieldTypes.Count ?
+                this : new BinaryStructure(_paths, _jumps, newFieldTypes);
+        }
+
+        /// <summary>
+        /// Recorded field types.
+        /// </summary>
+        internal IDictionary<string, byte> FieldTypes
+        {
+            get { return _fieldTypes; }
+        } 
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/894057e5/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Structure/BinaryStructureEntry.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Structure/BinaryStructureEntry.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Structure/BinaryStructureEntry.cs
new file mode 100644
index 0000000..c0bf619
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Structure/BinaryStructureEntry.cs
@@ -0,0 +1,128 @@
+/*
+ * 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.Structure
+{
+    using System.Diagnostics;
+    using Apache.Ignite.Core.Binary;
+
+    /// <summary>
+    /// Binary type structure entry. Might be either a normal field, a reference to jump table, or an empty entry.
+    /// </summary>
+    internal struct BinaryStructureEntry
+    {
+        /** Field name. */
+        private readonly string _name;
+
+        /** Field ID. */
+        private readonly int _id;
+
+        /** Field type. */
+        private readonly byte _type;
+
+        /// <summary>
+        /// Constructor for jump table entry.
+        /// </summary>
+        /// <param name="jumpTblIdx">Jump table index.</param>
+        public BinaryStructureEntry(int jumpTblIdx)
+        {
+            Debug.Assert(jumpTblIdx > 0);
+
+            _name = null;
+            _id = jumpTblIdx;
+            _type = 0;
+        }
+
+        /// <summary>
+        /// Constructor for field entry.
+        /// </summary>
+        /// <param name="name">Field name.</param>
+        /// <param name="id">Field ID.</param>
+        /// <param name="type">Field type.</param>
+        public BinaryStructureEntry(string name, int id, byte type)
+        {
+            Debug.Assert(name != null);
+
+            _name = name;
+            _id = id;
+            _type = type;
+        }
+
+        /// <summary>
+        /// Check whether current field entry matches passed arguments.
+        /// </summary>
+        /// <param name="name">Field name.</param>
+        /// <param name="type">Field type.</param>
+        /// <returns>True if expected.</returns>
+        public bool IsExpected(string name, byte type)
+        {
+            // Perform reference equality check first because field name is a literal in most cases.
+            if (!ReferenceEquals(_name, name) && !name.Equals(_name))
+                return false;
+
+            ValidateType(type);
+
+            return true;
+        }
+
+        /// <summary>
+        /// Validate field type.
+        /// </summary>
+        /// <param name="type">Expected type.</param>
+        public void ValidateType(byte type)
+        {
+            if (_type != type)
+            {
+                throw new BinaryObjectException("Field type mismatch detected [fieldName=" + _name +
+                    ", expectedType=" + _type + ", actualType=" + type + ']');
+            }
+        }
+
+        /// <summary>
+        /// Whether this is an empty entry.
+        /// </summary>
+        /// <returns></returns>
+        public bool IsEmpty
+        {
+            get { return _id == 0; }
+        }
+
+        /// <summary>
+        /// Whether this is a jump table.
+        /// </summary>
+        public bool IsJumpTable
+        {
+            get { return _name == null && _id >= 0; }
+        }
+
+        /// <summary>
+        /// Field name.
+        /// </summary>
+        public string Name
+        {
+            get { return _name; }
+        }
+
+        /// <summary>
+        /// Field ID.
+        /// </summary>
+        public int Id
+        {
+            get { return _id; }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/894057e5/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Structure/BinaryStructureJumpTable.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Structure/BinaryStructureJumpTable.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Structure/BinaryStructureJumpTable.cs
new file mode 100644
index 0000000..60eb9bf
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Structure/BinaryStructureJumpTable.cs
@@ -0,0 +1,118 @@
+/*
+ * 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.Structure
+{
+    using System;
+    using System.Diagnostics;
+
+    /// <summary>
+    /// Jump table.
+    /// </summary>
+    internal class BinaryStructureJumpTable
+    {
+        /** Names. */
+        private readonly string[] _names;
+
+        /** Path indexes. */
+        private readonly int[] _pathIdxs;
+
+        /// <summary>
+        /// Create minimal jump table with two entries.
+        /// </summary>
+        /// <param name="firstName">First name.</param>
+        /// <param name="firstPathIdx">First path index.</param>
+        /// <param name="secondName">Second name.</param>
+        /// <param name="secondPathIdx">Second path index.</param>
+        public BinaryStructureJumpTable(string firstName, int firstPathIdx, 
+            string secondName, int secondPathIdx)
+        {
+            _names = new[] { firstName, secondName };
+            _pathIdxs = new[] { firstPathIdx, secondPathIdx };
+        }
+
+        /// <summary>
+        /// Constructor.
+        /// </summary>
+        /// <param name="names">Field names.</param>
+        /// <param name="pathIdxs">Path indexes.</param>
+        private BinaryStructureJumpTable(string[] names, int[] pathIdxs)
+        {
+            Debug.Assert(names.Length > 1);
+            Debug.Assert(names.Length == pathIdxs.Length);
+            
+            _names = names;
+            _pathIdxs = pathIdxs;
+        }
+
+        /// <summary>
+        /// Get path index for the given field.
+        /// </summary>
+        /// <param name="fieldName">Field name.</param>
+        /// <returns>Path index.</returns>
+        public int GetPathIndex(string fieldName)
+        {
+            Debug.Assert(fieldName != null);
+            
+            // Optimistically assume that field name is a literal.
+            for (var i = 0; i < _names.Length; i++)
+            {
+                if (ReferenceEquals(fieldName, _names[i]))
+                    return _pathIdxs[i];
+            }
+
+            // Fallback to slow-path with normal string comparison.
+            for (var i = 0; i < _names.Length; i++)
+            {
+                if (fieldName.Equals(_names[i]))
+                    return _pathIdxs[i];
+            }
+
+            // No path found for the field.
+            return -1;
+        }
+
+        /// <summary>
+        /// Copy jump table.
+        /// </summary>
+        /// <returns>New jump table.</returns>
+        public BinaryStructureJumpTable Copy()
+        {
+            return new BinaryStructureJumpTable(_names, _pathIdxs);
+        }
+
+        /// <summary>
+        /// Copy jump table with additional jump.
+        /// </summary>
+        /// <param name="name">Field name.</param>
+        /// <param name="pathIdx">Path index.</param>
+        /// <returns>New jump table.</returns>
+        public BinaryStructureJumpTable CopyAndAdd(string name, int pathIdx)
+        {
+            var newNames = new string[_names.Length + 1];
+            var newPathIdxs = new int[_pathIdxs.Length + 1];
+
+            Array.Copy(_names, newNames, _names.Length);
+            Array.Copy(_pathIdxs, newPathIdxs, _pathIdxs.Length);
+
+            newNames[newNames.Length - 1] = name;
+            newPathIdxs[newPathIdxs.Length - 1] = pathIdx;
+
+            return new BinaryStructureJumpTable(newNames, newPathIdxs);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/894057e5/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
new file mode 100644
index 0000000..37d980e
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Structure/BinaryStructureTracker.cs
@@ -0,0 +1,140 @@
+/*
+ * 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.Structure
+{
+    using System.Collections.Generic;
+
+    /// <summary>
+    /// Encapsulates logic for tracking field access and updating type descriptor structure.
+    /// </summary>
+    internal struct BinaryStructureTracker
+    {
+        /** Current type structure. */
+        private readonly IBinaryTypeDescriptor _desc;
+
+        /** Struct. */
+        private readonly BinaryStructure _portStruct;
+
+        /** Current type structure path index. */
+        private int _curStructPath;
+
+        /** Current type structure action index. */
+        private int _curStructAction;
+
+        /** Current type structure updates. */
+        private List<BinaryStructureUpdate> _curStructUpdates;
+
+        /// <summary>
+        /// Initializes a new instance of the <see cref="BinaryStructureTracker" /> class.
+        /// </summary>
+        /// <param name="desc">The desc.</param>
+        /// <param name="portStruct">The structure to work with.</param>
+        public BinaryStructureTracker(IBinaryTypeDescriptor desc, BinaryStructure portStruct)
+        {
+            _desc = desc;
+            _portStruct = portStruct;
+            _curStructPath = 0;
+            _curStructAction = 0;
+            _curStructUpdates = null;
+        }
+
+        /// <summary>
+        /// Gets the current structure action.
+        /// </summary>
+        public int CurStructAction
+        {
+            get { return _curStructAction; }
+        }
+
+        /// <summary>
+        /// Gets the field ID.
+        /// </summary>
+        public int GetFieldId(string fieldName, byte fieldTypeId = 0)
+        {
+            _curStructAction++;
+
+            if (_curStructUpdates == null)
+            {
+                var fieldId = _portStruct.GetFieldId(fieldName, fieldTypeId, ref _curStructPath,
+                    _curStructAction);
+
+                if (fieldId != 0)
+                    return fieldId;
+            }
+
+            return GetNewFieldId(fieldName, fieldTypeId, _curStructAction);
+        }
+
+        /// <summary>
+        /// Updates the type structure.
+        /// </summary>
+        public void UpdateReaderStructure()
+        {
+            if (_curStructUpdates != null)
+                _desc.UpdateReadStructure(_desc.ReaderTypeStructure, _curStructPath, _curStructUpdates);
+        }
+
+        /// <summary>
+        /// Updates the type structure and metadata for the specified writer.
+        /// </summary>
+        /// <param name="writer">The writer.</param>
+        public void UpdateWriterStructure(BinaryWriter writer)
+        {
+            if (_curStructUpdates != null)
+            {
+                _desc.UpdateWriteStructure(_desc.WriterTypeStructure, _curStructPath, _curStructUpdates);
+
+                var marsh = writer.Marshaller;
+
+                var metaHnd = marsh.GetBinaryTypeHandler(_desc);
+
+                if (metaHnd != null)
+                {
+                    foreach (var u in _curStructUpdates)
+                        metaHnd.OnFieldWrite(u.FieldId, u.FieldName, u.FieldType);
+
+                    var meta = metaHnd.OnObjectWriteFinished();
+
+                    if (meta != null)
+                        writer.SaveMetadata(_desc.TypeId, _desc.TypeName, _desc.AffinityKeyFieldName, meta);
+                }
+            }
+        }
+
+        /// <summary>
+        /// Get ID for the new field and save structure update.
+        /// </summary>
+        /// <param name="fieldName">Field name.</param>
+        /// <param name="fieldTypeId">Field type ID.</param>
+        /// <param name="action">Action index.</param>
+        /// <returns>
+        /// Field ID.
+        /// </returns>
+        private int GetNewFieldId(string fieldName, byte fieldTypeId, int action)
+        {
+            var fieldId = BinaryUtils.FieldId(_desc.TypeId, fieldName, _desc.NameMapper, _desc.IdMapper);
+
+            if (_curStructUpdates == null)
+                _curStructUpdates = new List<BinaryStructureUpdate>();
+
+            _curStructUpdates.Add(new BinaryStructureUpdate(fieldName, fieldId, fieldTypeId, action));
+
+            return fieldId;
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/894057e5/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Structure/BinaryStructureUpdate.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Structure/BinaryStructureUpdate.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Structure/BinaryStructureUpdate.cs
new file mode 100644
index 0000000..0b74909
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Structure/BinaryStructureUpdate.cs
@@ -0,0 +1,84 @@
+/*
+ * 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.Structure
+{
+    /// <summary>
+    /// Binary type structure update descriptor.
+    /// </summary>
+    internal class BinaryStructureUpdate
+    {
+        /** Field name. */
+        private readonly string _fieldName;
+
+        /** Field ID. */
+        private readonly int _fieldId;
+
+        /** Field type. */
+        private readonly byte _fieldType;
+
+        /** Field index. */
+        private readonly int _idx;
+
+        /// <summary>
+        /// Constructor.
+        /// </summary>
+        /// <param name="fieldName">Field name.</param>
+        /// <param name="fieldId">Field ID.</param>
+        /// <param name="fieldType">Field type.</param>
+        /// <param name="idx">Index.</param>
+        public BinaryStructureUpdate(string fieldName, int fieldId, byte fieldType, int idx)
+        {
+            _fieldName = fieldName;
+            _fieldId = fieldId;
+            _fieldType = fieldType;
+            _idx = idx;
+        }
+
+        /// <summary>
+        /// Field name.
+        /// </summary>
+        public string FieldName
+        {
+            get { return _fieldName; }
+        }
+
+        /// <summary>
+        /// Field ID.
+        /// </summary>
+        public int FieldId
+        {
+            get { return _fieldId; }
+        }
+
+        /// <summary>
+        /// Field type.
+        /// </summary>
+        public byte FieldType
+        {
+            get { return _fieldType; }
+        }
+
+        /// <summary>
+        /// Index.
+        /// </summary>
+        public int Index
+        {
+            get { return _idx; }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/894057e5/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
new file mode 100644
index 0000000..340dac4
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/TypeResolver.cs
@@ -0,0 +1,231 @@
+/*
+ * 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.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>();
+
+        /// <summary>
+        /// Resolve type by name.
+        /// </summary>
+        /// <param name="typeName">Name of the type.</param>
+        /// <param name="assemblyName">Optional, name of the assembly.</param>
+        /// <returns>
+        /// Resolved type.
+        /// </returns>
+        public Type ResolveType(string typeName, string assemblyName = null)
+        {
+            Debug.Assert(!string.IsNullOrEmpty(typeName));
+
+            return ResolveType(assemblyName, typeName, AppDomain.CurrentDomain.GetAssemblies())
+                ?? ResolveTypeInReferencedAssemblies(assemblyName, typeName);
+        }
+
+        /// <summary>
+        /// Resolve type by name in specified assembly set.
+        /// </summary>
+        /// <param name="assemblyName">Name of the assembly.</param>
+        /// <param name="typeName">Name of the type.</param>
+        /// <param name="assemblies">Assemblies to look in.</param>
+        /// <returns> 
+        /// Resolved type. 
+        /// </returns>
+        private static Type ResolveType(string assemblyName, string typeName, ICollection<Assembly> assemblies)
+        {
+            return ResolveGenericType(assemblyName, typeName, assemblies) ??
+                   ResolveNonGenericType(assemblyName, typeName, assemblies);
+        }
+
+        /// <summary>
+        /// Resolves non-generic type by searching provided assemblies.
+        /// </summary>
+        /// <param name="assemblyName">Name of the assembly.</param>
+        /// <param name="typeName">Name of the type.</param>
+        /// <param name="assemblies">The assemblies.</param>
+        /// <returns>Resolved type, or null.</returns>
+        private static Type ResolveNonGenericType(string assemblyName, string typeName, ICollection<Assembly> assemblies)
+        {
+            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;
+        }
+
+        /// <summary>
+        /// Resolve type by name in non-loaded referenced assemblies.
+        /// </summary>
+        /// <param name="assemblyName">Name of the assembly.</param>
+        /// <param name="typeName">Name of the type.</param>
+        /// <returns>
+        /// Resolved type.
+        /// </returns>
+        private Type ResolveTypeInReferencedAssemblies(string assemblyName, string typeName)
+        {
+            ResolveEventHandler resolver = (sender, args) => GetReflectionOnlyAssembly(args.Name);
+
+            AppDomain.CurrentDomain.ReflectionOnlyAssemblyResolve += resolver;
+
+            try
+            {
+                var result = ResolveType(assemblyName, typeName, GetNotLoadedReferencedAssemblies().ToArray());
+
+                if (result == null)
+                    return null;
+
+                // result is from ReflectionOnly assembly, load it properly into current domain
+                var asm = AppDomain.CurrentDomain.Load(result.Assembly.GetName());
+
+                return asm.GetType(result.FullName);
+            }
+            finally
+            {
+                AppDomain.CurrentDomain.ReflectionOnlyAssemblyResolve -= resolver;
+            }
+        }
+
+        /// <summary>
+        /// Gets the reflection only assembly.
+        /// </summary>
+        [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes")]
+        private Assembly GetReflectionOnlyAssembly(string fullName)
+        {
+            Assembly result;
+
+            if (!_reflectionOnlyAssemblies.TryGetValue(fullName, out result))
+            {
+                try
+                {
+                    result = Assembly.ReflectionOnlyLoad(fullName);
+                }
+                catch (Exception)
+                {
+                    // Some assemblies may fail to load
+                    result = null;
+                }
+
+                _reflectionOnlyAssemblies[fullName] = result;
+            }
+
+            return result;
+        }
+
+        /// <summary>
+        /// Recursively gets all referenced assemblies for current app domain, excluding those that are loaded.
+        /// </summary>
+        private IEnumerable<Assembly> GetNotLoadedReferencedAssemblies()
+        {
+            var roots = new Stack<Assembly>(AppDomain.CurrentDomain.GetAssemblies());
+
+            var visited = new HashSet<string>();
+
+            var loaded = new HashSet<string>(roots.Select(x => x.FullName));
+
+            while (roots.Any())
+            {
+                var asm = roots.Pop();
+
+                if (visited.Contains(asm.FullName))
+                    continue;
+
+                if (!loaded.Contains(asm.FullName))
+                    yield return asm;
+
+                visited.Add(asm.FullName);
+
+                foreach (var refAsm in asm.GetReferencedAssemblies()
+                    .Where(x => !visited.Contains(x.FullName))
+                    .Where(x => !loaded.Contains(x.FullName))
+                    .Select(x => GetReflectionOnlyAssembly(x.FullName))
+                    .Where(x => x != null))
+                    roots.Push(refAsm);
+            }
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/894057e5/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheAffinityImpl.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheAffinityImpl.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheAffinityImpl.cs
index 4d9cd2d..00e13c5 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheAffinityImpl.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheAffinityImpl.cs
@@ -22,9 +22,9 @@ namespace Apache.Ignite.Core.Impl.Cache
     using System.Diagnostics;
     using Apache.Ignite.Core.Cache;
     using Apache.Ignite.Core.Cluster;
+    using Apache.Ignite.Core.Impl.Binary;
+    using Apache.Ignite.Core.Impl.Binary.IO;
     using Apache.Ignite.Core.Impl.Common;
-    using Apache.Ignite.Core.Impl.Portable;
-    using Apache.Ignite.Core.Impl.Portable.IO;
     using Apache.Ignite.Core.Impl.Unmanaged;
     using UU = Apache.Ignite.Core.Impl.Unmanaged.UnmanagedUtils;
 
@@ -76,7 +76,7 @@ namespace Apache.Ignite.Core.Impl.Cache
         private const int OpPrimaryPartitions = 14;
 
         /** */
-        private readonly bool _keepPortable;
+        private readonly bool _keepBinary;
         
         /** Grid. */
         private readonly Ignite _ignite;
@@ -86,12 +86,12 @@ namespace Apache.Ignite.Core.Impl.Cache
         /// </summary>
         /// <param name="target">Target.</param>
         /// <param name="marsh">Marshaller.</param>
-        /// <param name="keepPortable">Keep portable flag.</param>
+        /// <param name="keepBinary">Keep binary flag.</param>
         /// <param name="ignite">Grid.</param>
-        public CacheAffinityImpl(IUnmanagedTarget target, PortableMarshaller marsh, bool keepPortable, 
+        public CacheAffinityImpl(IUnmanagedTarget target, Marshaller marsh, bool keepBinary, 
             Ignite ignite) : base(target, marsh)
         {
-            _keepPortable = keepPortable;
+            _keepBinary = keepBinary;
 
             Debug.Assert(ignite != null);
             
@@ -222,9 +222,9 @@ namespace Apache.Ignite.Core.Impl.Cache
         }
 
         /** <inheritDoc /> */
-        protected override T Unmarshal<T>(IPortableStream stream)
+        protected override T Unmarshal<T>(IBinaryStream stream)
         {
-            return Marshaller.Unmarshal<T>(stream, _keepPortable);
+            return Marshaller.Unmarshal<T>(stream, _keepBinary);
         }
 
 
@@ -241,7 +241,7 @@ namespace Apache.Ignite.Core.Impl.Cache
         /// <summary>
         /// Reads a node from stream.
         /// </summary>
-        private IClusterNode ReadNode(PortableReaderImpl r)
+        private IClusterNode ReadNode(BinaryReader r)
         {
             return GetNode(r.ReadGuid());
         }
@@ -249,18 +249,18 @@ namespace Apache.Ignite.Core.Impl.Cache
         /// <summary>
         /// Reads nodes from stream.
         /// </summary>
-        private IList<IClusterNode> ReadNodes(IPortableStream reader)
+        private IList<IClusterNode> ReadNodes(IBinaryStream reader)
         {
-            return IgniteUtils.ReadNodes(Marshaller.StartUnmarshal(reader, _keepPortable));
+            return IgniteUtils.ReadNodes(Marshaller.StartUnmarshal(reader, _keepBinary));
         }
 
         /// <summary>
         /// Reads a dictionary from stream.
         /// </summary>
-        private Dictionary<TK, TV> ReadDictionary<TK, TV>(IPortableStream reader, Func<PortableReaderImpl, TK> readKey,
-            Func<PortableReaderImpl, TV> readVal)
+        private Dictionary<TK, TV> ReadDictionary<TK, TV>(IBinaryStream reader, Func<BinaryReader, TK> readKey,
+            Func<BinaryReader, TV> readVal)
         {
-            var r = Marshaller.StartUnmarshal(reader, _keepPortable);
+            var r = Marshaller.StartUnmarshal(reader, _keepBinary);
 
             var cnt = r.ReadInt();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/894057e5/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheEntryFilterHolder.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheEntryFilterHolder.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheEntryFilterHolder.cs
index c01103e..0963145 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheEntryFilterHolder.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheEntryFilterHolder.cs
@@ -19,16 +19,16 @@ namespace Apache.Ignite.Core.Impl.Cache
 {
     using System;
     using System.Diagnostics;
+    using Apache.Ignite.Core.Binary;
     using Apache.Ignite.Core.Cache;
+    using Apache.Ignite.Core.Impl.Binary;
+    using Apache.Ignite.Core.Impl.Binary.IO;
     using Apache.Ignite.Core.Impl.Common;
-    using Apache.Ignite.Core.Impl.Portable;
-    using Apache.Ignite.Core.Impl.Portable.IO;
-    using Apache.Ignite.Core.Portable;
 
     /// <summary>
-    /// Non-generic portable filter wrapper.
+    /// Non-generic binary filter wrapper.
     /// </summary>
-    internal class CacheEntryFilterHolder : IPortableWriteAware
+    internal class CacheEntryFilterHolder : IBinaryWriteAware
     {
         /** Wrapped ICacheEntryFilter */
         private readonly object _pred;
@@ -36,11 +36,11 @@ namespace Apache.Ignite.Core.Impl.Cache
         /** Invoker function that takes key and value and invokes wrapped ICacheEntryFilter */
         private readonly Func<object, object, bool> _invoker;
         
-        /** Keep portable flag. */
-        private readonly bool _keepPortable;
+        /** Keep binary flag. */
+        private readonly bool _keepBinary;
 
         /** Grid. */
-        private readonly PortableMarshaller _marsh;
+        private readonly Marshaller _marsh;
         
         /** Handle. */
         private readonly long _handle;
@@ -51,9 +51,9 @@ namespace Apache.Ignite.Core.Impl.Cache
         /// <param name="pred">The <see cref="ICacheEntryFilter{TK,TV}" /> to wrap.</param>
         /// <param name="invoker">The invoker func that takes key and value and invokes wrapped ICacheEntryFilter.</param>
         /// <param name="marsh">Marshaller.</param>
-        /// <param name="keepPortable">Keep portable flag.</param>
-        public CacheEntryFilterHolder(object pred, Func<object, object, bool> invoker, PortableMarshaller marsh, 
-            bool keepPortable)
+        /// <param name="keepBinary">Keep binary flag.</param>
+        public CacheEntryFilterHolder(object pred, Func<object, object, bool> invoker, Marshaller marsh, 
+            bool keepBinary)
         {
             Debug.Assert(pred != null);
             Debug.Assert(invoker != null);
@@ -62,7 +62,7 @@ namespace Apache.Ignite.Core.Impl.Cache
             _pred = pred;
             _invoker = invoker;
             _marsh = marsh;
-            _keepPortable = keepPortable;
+            _keepBinary = keepBinary;
 
             _handle = marsh.Ignite.HandleRegistry.Allocate(this);
         }
@@ -80,34 +80,34 @@ namespace Apache.Ignite.Core.Impl.Cache
         /// </summary>
         /// <param name="input">The input stream.</param>
         /// <returns>Invocation result.</returns>
-        public int Invoke(IPortableStream input)
+        public int Invoke(IBinaryStream input)
         {
-            var rawReader = _marsh.StartUnmarshal(input, _keepPortable).GetRawReader();
+            var rawReader = _marsh.StartUnmarshal(input, _keepBinary).GetRawReader();
 
             return _invoker(rawReader.ReadObject<object>(), rawReader.ReadObject<object>()) ? 1 : 0;
         }
 
         /** <inheritdoc /> */
-        public void WritePortable(IPortableWriter writer)
+        public void WriteBinary(IBinaryWriter writer)
         {
-            var writer0 = (PortableWriterImpl)writer.GetRawWriter();
+            var writer0 = (BinaryWriter)writer.GetRawWriter();
 
             writer0.WithDetach(w => w.WriteObject(_pred));
             
-            writer0.WriteBoolean(_keepPortable);
+            writer0.WriteBoolean(_keepBinary);
         }
 
         /// <summary>
         /// Initializes a new instance of the <see cref="CacheEntryFilterHolder"/> class.
         /// </summary>
         /// <param name="reader">The reader.</param>
-        public CacheEntryFilterHolder(IPortableReader reader)
+        public CacheEntryFilterHolder(IBinaryReader reader)
         {
-            var reader0 = (PortableReaderImpl)reader.GetRawReader();
+            var reader0 = (BinaryReader)reader.GetRawReader();
 
             _pred = reader0.ReadObject<object>();
 
-            _keepPortable = reader0.ReadBoolean();
+            _keepBinary = reader0.ReadBoolean();
 
             _marsh = reader0.Marshaller;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/894057e5/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheEntryProcessorHolder.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheEntryProcessorHolder.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheEntryProcessorHolder.cs
index 3f21b53..a0f8f3a 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheEntryProcessorHolder.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheEntryProcessorHolder.cs
@@ -21,17 +21,17 @@ namespace Apache.Ignite.Core.Impl.Cache
     using System.Diagnostics;
     using System.Diagnostics.CodeAnalysis;
     using System.Reflection;
+    using Apache.Ignite.Core.Binary;
     using Apache.Ignite.Core.Cache;
+    using Apache.Ignite.Core.Impl.Binary;
     using Apache.Ignite.Core.Impl.Common;
-    using Apache.Ignite.Core.Impl.Portable;
     using Apache.Ignite.Core.Impl.Resource;
-    using Apache.Ignite.Core.Portable;
 
     /// <summary>
-    /// Portable wrapper for the <see cref="ICacheEntryProcessor{TK,TV,TA,TR}"/> and it's argument.
+    /// Binary wrapper for the <see cref="ICacheEntryProcessor{TK,TV,TA,TR}"/> and it's argument.
     /// Marshals and executes wrapped processor with a non-generic interface.
     /// </summary>
-    internal class CacheEntryProcessorHolder : IPortableWriteAware
+    internal class CacheEntryProcessorHolder : IBinaryWriteAware
     {
         // generic processor
         private readonly object _proc;
@@ -101,9 +101,9 @@ namespace Apache.Ignite.Core.Impl.Cache
         }
 
         /** <inheritDoc /> */
-        public void WritePortable(IPortableWriter writer)
+        public void WriteBinary(IBinaryWriter writer)
         {
-            var writer0 = (PortableWriterImpl) writer.GetRawWriter();
+            var writer0 = (BinaryWriter) writer.GetRawWriter();
 
             writer0.WithDetach(w => w.WriteObject(_proc));
             writer0.WithDetach(w => w.WriteObject(_arg));
@@ -113,9 +113,9 @@ namespace Apache.Ignite.Core.Impl.Cache
         /// Initializes a new instance of the <see cref="CacheEntryProcessorHolder"/> class.
         /// </summary>
         /// <param name="reader">The reader.</param>
-        public CacheEntryProcessorHolder(IPortableReader reader)
+        public CacheEntryProcessorHolder(IBinaryReader reader)
         {
-            var reader0 = (PortableReaderImpl) reader.GetRawReader();
+            var reader0 = (BinaryReader) reader.GetRawReader();
 
             _proc = reader0.ReadObject<object>();
             _arg = reader0.ReadObject<object>();

http://git-wip-us.apache.org/repos/asf/ignite/blob/894057e5/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheEntryProcessorResultHolder.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheEntryProcessorResultHolder.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheEntryProcessorResultHolder.cs
index a6641e1..dc66155 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheEntryProcessorResultHolder.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheEntryProcessorResultHolder.cs
@@ -21,8 +21,9 @@ namespace Apache.Ignite.Core.Impl.Cache
     using System.Diagnostics.CodeAnalysis;
     using System.Globalization;
     using System.IO;
-    using Apache.Ignite.Core.Impl.Portable;
-    using Apache.Ignite.Core.Impl.Portable.IO;
+    using Apache.Ignite.Core.Impl.Binary;
+    using Apache.Ignite.Core.Impl.Binary.IO;
+    using BinaryWriter = Apache.Ignite.Core.Impl.Binary.BinaryWriter;
 
     /// <summary>
     /// Manages cache entry processing result in non-generic form.
@@ -62,7 +63,7 @@ namespace Apache.Ignite.Core.Impl.Cache
         /// </summary>
         /// <param name="stream">Stream.</param>
         /// <param name="marsh">Marshaller.</param>
-        public void Write(IPortableStream stream, PortableMarshaller marsh)
+        public void Write(IBinaryStream stream, Marshaller marsh)
         {
             var writer = marsh.StartMarshal(stream);
 
@@ -82,7 +83,7 @@ namespace Apache.Ignite.Core.Impl.Cache
         /// <param name="writer">Writer.</param>
         [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes",
             Justification = "Any kind of exception can be thrown during user type marshalling.")]
-        private void Marshal(PortableWriterImpl writer)
+        private void Marshal(BinaryWriter writer)
         {
             var pos = writer.Stream.Position;
 
@@ -99,7 +100,7 @@ namespace Apache.Ignite.Core.Impl.Cache
                 }
                 else
                 {
-                    writer.WriteByte((byte) MutableCacheEntryState.ErrPortable);
+                    writer.WriteByte((byte) MutableCacheEntryState.ErrBinary);
                     writer.Write(Error);
                 }
             }

http://git-wip-us.apache.org/repos/asf/ignite/blob/894057e5/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheEnumerator.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheEnumerator.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheEnumerator.cs
index fd26558..e2b8350 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheEnumerator.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheEnumerator.cs
@@ -21,8 +21,8 @@ namespace Apache.Ignite.Core.Impl.Cache
     using System.Collections;
     using System.Collections.Generic;
     using Apache.Ignite.Core.Cache;
-    using Apache.Ignite.Core.Impl.Portable;
-    using Apache.Ignite.Core.Impl.Portable.IO;
+    using Apache.Ignite.Core.Impl.Binary;
+    using Apache.Ignite.Core.Impl.Binary.IO;
     using Apache.Ignite.Core.Impl.Unmanaged;
 
     /// <summary>
@@ -33,8 +33,8 @@ namespace Apache.Ignite.Core.Impl.Cache
         /** Operation: next value. */
         private const int OpNext = 1;
 
-        /** Keep portable flag. */
-        private readonly bool _keepPortable;
+        /** Keep binary flag. */
+        private readonly bool _keepBinary;
 
         /** Current entry. */
         private CacheEntry<TK, TV>? _cur;
@@ -44,11 +44,11 @@ namespace Apache.Ignite.Core.Impl.Cache
         /// </summary>
         /// <param name="target">Target.</param>
         /// <param name="marsh">Marshaller.</param>
-        /// <param name="keepPortable">Keep portable flag.</param>
-        public CacheEnumerator(IUnmanagedTarget target, PortableMarshaller marsh, bool keepPortable) : 
+        /// <param name="keepBinary">Keep binary flag.</param>
+        public CacheEnumerator(IUnmanagedTarget target, Marshaller marsh, bool keepBinary) : 
             base(target, marsh)
         {
-            _keepPortable = keepPortable;
+            _keepBinary = keepBinary;
         }
 
         /** <inheritdoc /> */
@@ -58,7 +58,7 @@ namespace Apache.Ignite.Core.Impl.Cache
 
             return DoInOp(OpNext, stream =>
             {
-                var reader = Marshaller.StartUnmarshal(stream, _keepPortable);
+                var reader = Marshaller.StartUnmarshal(stream, _keepBinary);
 
                 bool hasNext = reader.ReadBoolean();
 
@@ -109,7 +109,7 @@ namespace Apache.Ignite.Core.Impl.Cache
         }
 
         /** <inheritdoc /> */
-        protected override T Unmarshal<T>(IPortableStream stream)
+        protected override T Unmarshal<T>(IBinaryStream stream)
         {
             throw new InvalidOperationException("Should not be called.");
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/894057e5/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs
index 4ceb292..a6dfe7e 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs
@@ -23,17 +23,17 @@ namespace Apache.Ignite.Core.Impl.Cache
     using System.Diagnostics;
     using System.Diagnostics.CodeAnalysis;
     using System.Threading.Tasks;
+    using Apache.Ignite.Core.Binary;
     using Apache.Ignite.Core.Cache;
     using Apache.Ignite.Core.Cache.Expiry;
     using Apache.Ignite.Core.Cache.Query;
     using Apache.Ignite.Core.Cache.Query.Continuous;
+    using Apache.Ignite.Core.Impl.Binary;
+    using Apache.Ignite.Core.Impl.Binary.IO;
     using Apache.Ignite.Core.Impl.Cache.Query;
     using Apache.Ignite.Core.Impl.Cache.Query.Continuous;
     using Apache.Ignite.Core.Impl.Common;
-    using Apache.Ignite.Core.Impl.Portable;
-    using Apache.Ignite.Core.Impl.Portable.IO;
     using Apache.Ignite.Core.Impl.Unmanaged;
-    using Apache.Ignite.Core.Portable;
     using UU = Apache.Ignite.Core.Impl.Unmanaged.UnmanagedUtils;
 
     /// <summary>
@@ -57,8 +57,8 @@ namespace Apache.Ignite.Core.Impl.Cache
         /** Flag: skip store. */
         private readonly bool _flagSkipStore;
 
-        /** Flag: keep portable. */
-        private readonly bool _flagKeepPortable;
+        /** Flag: keep binary. */
+        private readonly bool _flagKeepBinary;
 
         /** Flag: async mode.*/
         private readonly bool _flagAsync;
@@ -76,15 +76,15 @@ namespace Apache.Ignite.Core.Impl.Cache
         /// <param name="target">Target.</param>
         /// <param name="marsh">Marshaller.</param>
         /// <param name="flagSkipStore">Skip store flag.</param>
-        /// <param name="flagKeepPortable">Keep portable flag.</param>
+        /// <param name="flagKeepBinary">Keep binary flag.</param>
         /// <param name="flagAsync">Async mode flag.</param>
         /// <param name="flagNoRetries">No-retries mode flag.</param>
-        public CacheImpl(Ignite grid, IUnmanagedTarget target, PortableMarshaller marsh,
-            bool flagSkipStore, bool flagKeepPortable, bool flagAsync, bool flagNoRetries) : base(target, marsh)
+        public CacheImpl(Ignite grid, IUnmanagedTarget target, Marshaller marsh,
+            bool flagSkipStore, bool flagKeepBinary, bool flagAsync, bool flagNoRetries) : base(target, marsh)
         {
             _ignite = grid;
             _flagSkipStore = flagSkipStore;
-            _flagKeepPortable = flagKeepPortable;
+            _flagKeepBinary = flagKeepBinary;
             _flagAsync = flagAsync;
             _flagNoRetries = flagNoRetries;
 
@@ -99,7 +99,7 @@ namespace Apache.Ignite.Core.Impl.Cache
         {
             _ignite = cache._ignite;
             _flagSkipStore = cache._flagSkipStore;
-            _flagKeepPortable = cache._flagKeepPortable;
+            _flagKeepBinary = cache._flagKeepBinary;
             _flagAsync = true;
             _flagNoRetries = cache._flagNoRetries;
         }
@@ -137,12 +137,12 @@ namespace Apache.Ignite.Core.Impl.Cache
         /// <returns>
         /// Task for previous asynchronous operation.
         /// </returns>
-        private Task<TResult> GetTask<TResult>(CacheOp lastAsyncOp, Func<PortableReaderImpl, TResult> converter = null)
+        private Task<TResult> GetTask<TResult>(CacheOp lastAsyncOp, Func<BinaryReader, TResult> converter = null)
         {
             Debug.Assert(_flagAsync);
 
             return GetFuture((futId, futTypeId) => UU.TargetListenFutureForOperation(Target, futId, futTypeId, 
-                (int) lastAsyncOp), _flagKeepPortable, converter).Task;
+                (int) lastAsyncOp), _flagKeepBinary, converter).Task;
         }
 
         /** <inheritDoc /> */
@@ -166,7 +166,7 @@ namespace Apache.Ignite.Core.Impl.Cache
                 return this;
 
             return new CacheImpl<TK, TV>(_ignite, UU.CacheWithSkipStore(Target), Marshaller, 
-                true, _flagKeepPortable, _flagAsync, true);
+                true, _flagKeepBinary, _flagAsync, true);
         }
 
         /// <summary>
@@ -175,21 +175,21 @@ namespace Apache.Ignite.Core.Impl.Cache
         internal bool IsSkipStore { get { return _flagSkipStore; } }
 
         /** <inheritDoc /> */
-        public ICache<TK1, TV1> WithKeepPortable<TK1, TV1>()
+        public ICache<TK1, TV1> WithKeepBinary<TK1, TV1>()
         {
-            if (_flagKeepPortable)
+            if (_flagKeepBinary)
             {
                 var result = this as ICache<TK1, TV1>;
 
                 if (result == null)
                     throw new InvalidOperationException(
-                        "Can't change type of portable cache. WithKeepPortable has been called on an instance of " +
-                        "portable cache with incompatible generic arguments.");
+                        "Can't change type of binary cache. WithKeepBinary has been called on an instance of " +
+                        "binary cache with incompatible generic arguments.");
 
                 return result;
             }
 
-            return new CacheImpl<TK1, TV1>(_ignite, UU.CacheWithKeepPortable(Target), Marshaller, 
+            return new CacheImpl<TK1, TV1>(_ignite, UU.CacheWithKeepBinary(Target), Marshaller, 
                 _flagSkipStore, true, _flagAsync, _flagNoRetries);
         }
 
@@ -204,7 +204,7 @@ namespace Apache.Ignite.Core.Impl.Cache
 
             IUnmanagedTarget cache0 = UU.CacheWithExpiryPolicy(Target, create, update, access);
 
-            return new CacheImpl<TK, TV>(_ignite, cache0, Marshaller, _flagSkipStore, _flagKeepPortable, _flagAsync, _flagNoRetries);
+            return new CacheImpl<TK, TV>(_ignite, cache0, Marshaller, _flagSkipStore, _flagKeepBinary, _flagAsync, _flagNoRetries);
         }
 
         /// <summary>
@@ -228,9 +228,9 @@ namespace Apache.Ignite.Core.Impl.Cache
         }
 
         /** <inheritDoc /> */
-        public bool IsKeepPortable
+        public bool IsKeepBinary
         {
-            get { return _flagKeepPortable; }
+            get { return _flagKeepBinary; }
         }
 
         /** <inheritDoc /> */
@@ -271,7 +271,7 @@ namespace Apache.Ignite.Core.Impl.Cache
                 if (p != null)
                 {
                     var p0 = new CacheEntryFilterHolder(p, (k, v) => p.Invoke(new CacheEntry<TK, TV>((TK)k, (TV)v)),
-                        Marshaller, IsKeepPortable);
+                        Marshaller, IsKeepBinary);
                     writer.WriteObject(p0);
                     writer.WriteLong(p0.Handle);
                 }
@@ -430,7 +430,7 @@ namespace Apache.Ignite.Core.Impl.Cache
                 writer => WriteEnumerable(writer, keys),
                 input =>
                 {
-                    var reader = Marshaller.StartUnmarshal(input, _flagKeepPortable);
+                    var reader = Marshaller.StartUnmarshal(input, _flagKeepBinary);
 
                     return ReadGetAllDictionary(reader);
                 });
@@ -883,7 +883,7 @@ namespace Apache.Ignite.Core.Impl.Cache
         {
             return DoInOp((int)CacheOp.Metrics, stream =>
             {
-                IPortableRawReader reader = Marshaller.StartUnmarshal(stream, false);
+                IBinaryRawReader reader = Marshaller.StartUnmarshal(stream, false);
 
                 return new CacheMetricsImpl(reader);
             });
@@ -902,7 +902,7 @@ namespace Apache.Ignite.Core.Impl.Cache
                 return this;
 
             return new CacheImpl<TK, TV>(_ignite, UU.CacheWithNoRetries(Target), Marshaller,
-                _flagSkipStore, _flagKeepPortable, _flagAsync, true);
+                _flagSkipStore, _flagKeepBinary, _flagAsync, true);
         }
 
         /// <summary>
@@ -940,7 +940,7 @@ namespace Apache.Ignite.Core.Impl.Cache
                 cursor = UU.CacheOutOpQueryCursor(Target, (int) CacheOp.QrySqlFields, stream.SynchronizeOutput());
             }
         
-            return new FieldsQueryCursor(cursor, Marshaller, _flagKeepPortable);
+            return new FieldsQueryCursor(cursor, Marshaller, _flagKeepBinary);
         }
 
         /** <inheritDoc /> */
@@ -954,14 +954,14 @@ namespace Apache.Ignite.Core.Impl.Cache
             {
                 var writer = Marshaller.StartMarshal(stream);
 
-                qry.Write(writer, IsKeepPortable);
+                qry.Write(writer, IsKeepBinary);
 
                 FinishMarshal(writer);
 
                 cursor = UU.CacheOutOpQueryCursor(Target, (int)qry.OpId, stream.SynchronizeOutput()); 
             }
 
-            return new QueryCursor<TK, TV>(cursor, Marshaller, _flagKeepPortable);
+            return new QueryCursor<TK, TV>(cursor, Marshaller, _flagKeepBinary);
         }
                 
         /// <summary>
@@ -969,7 +969,7 @@ namespace Apache.Ignite.Core.Impl.Cache
         /// </summary>
         /// <param name="writer">Writer.</param>
         /// <param name="args">Arguments.</param>
-        private static void WriteQueryArgs(PortableWriterImpl writer, object[] args)
+        private static void WriteQueryArgs(BinaryWriter writer, object[] args)
         {
             if (args == null)
                 writer.WriteInt(0);
@@ -1007,7 +1007,7 @@ namespace Apache.Ignite.Core.Impl.Cache
         {
             qry.Validate();
 
-            var hnd = new ContinuousQueryHandleImpl<TK, TV>(qry, Marshaller, _flagKeepPortable);
+            var hnd = new ContinuousQueryHandleImpl<TK, TV>(qry, Marshaller, _flagKeepBinary);
 
             using (var stream = IgniteManager.Memory.Allocate().GetStream())
             {
@@ -1019,7 +1019,7 @@ namespace Apache.Ignite.Core.Impl.Cache
                     {
                         writer.WriteInt((int) initialQry.OpId);
 
-                        initialQry.Write(writer, IsKeepPortable);
+                        initialQry.Write(writer, IsKeepBinary);
                     }
                     else
                         writer.WriteInt(-1); // no initial query
@@ -1065,17 +1065,17 @@ namespace Apache.Ignite.Core.Impl.Cache
         internal CacheEnumerator<TK, TV> CreateEnumerator(bool loc, int peekModes)
         {
             if (loc)
-                return new CacheEnumerator<TK, TV>(UU.CacheLocalIterator(Target, peekModes), Marshaller, _flagKeepPortable);
+                return new CacheEnumerator<TK, TV>(UU.CacheLocalIterator(Target, peekModes), Marshaller, _flagKeepBinary);
 
-            return new CacheEnumerator<TK, TV>(UU.CacheIterator(Target), Marshaller, _flagKeepPortable);
+            return new CacheEnumerator<TK, TV>(UU.CacheIterator(Target), Marshaller, _flagKeepBinary);
         }
 
         #endregion
 
         /** <inheritDoc /> */
-        protected override T Unmarshal<T>(IPortableStream stream)
+        protected override T Unmarshal<T>(IBinaryStream stream)
         {
-            return Marshaller.Unmarshal<T>(stream, _flagKeepPortable);
+            return Marshaller.Unmarshal<T>(stream, _flagKeepBinary);
         }
 
         /// <summary>
@@ -1095,7 +1095,7 @@ namespace Apache.Ignite.Core.Impl.Cache
         }
 
         /// <summary>
-        /// Unwraps an exception from PortableResultHolder, if any. Otherwise does the cast.
+        /// Unwraps an exception.
         /// </summary>
         /// <typeparam name="T">Result type.</typeparam>
         /// <param name="obj">Object.</param>
@@ -1116,7 +1116,7 @@ namespace Apache.Ignite.Core.Impl.Cache
         /// <typeparam name="T">The type of the result.</typeparam>
         /// <param name="inStream">Stream.</param>
         /// <returns>Results of InvokeAll operation.</returns>
-        private IDictionary<TK, ICacheEntryProcessorResult<T>> ReadInvokeAllResults<T>(IPortableStream inStream)
+        private IDictionary<TK, ICacheEntryProcessorResult<T>> ReadInvokeAllResults<T>(IBinaryStream inStream)
         {
             var count = inStream.ReadInt();
 
@@ -1140,11 +1140,11 @@ namespace Apache.Ignite.Core.Impl.Cache
         }
 
         /// <summary>
-        /// Reads the exception, either in portable wrapper form, or as a pair of strings.
+        /// Reads the exception, either in binary wrapper form, or as a pair of strings.
         /// </summary>
         /// <param name="inStream">The stream.</param>
         /// <returns>Exception.</returns>
-        private CacheEntryProcessorException ReadException(IPortableStream inStream)
+        private CacheEntryProcessorException ReadException(IBinaryStream inStream)
         {
             var item = Unmarshal<object>(inStream);
 
@@ -1163,9 +1163,9 @@ namespace Apache.Ignite.Core.Impl.Cache
         /// </summary>
         /// <param name="reader">Reader.</param>
         /// <returns>Dictionary.</returns>
-        private static IDictionary<TK, TV> ReadGetAllDictionary(PortableReaderImpl reader)
+        private static IDictionary<TK, TV> ReadGetAllDictionary(BinaryReader reader)
         {
-            IPortableStream stream = reader.Stream;
+            IBinaryStream stream = reader.Stream;
 
             if (stream.ReadBool())
             {
@@ -1189,7 +1189,7 @@ namespace Apache.Ignite.Core.Impl.Cache
         /// <summary>
         /// Gets the cache result.
         /// </summary>
-        private static CacheResult<TV> GetCacheResult(PortableReaderImpl reader)
+        private static CacheResult<TV> GetCacheResult(BinaryReader reader)
         {
             var res = reader == null
                 ? new CacheResult<TV>()
@@ -1227,7 +1227,7 @@ namespace Apache.Ignite.Core.Impl.Cache
         /// <param name="type">Operation type.</param>
         /// <param name="outAction">Out action.</param>
         /// <returns>Result.</returns>
-        private CacheResult<TR> DoOutInOpNullable<TR>(int type, Action<PortableWriterImpl> outAction)
+        private CacheResult<TR> DoOutInOpNullable<TR>(int type, Action<BinaryWriter> outAction)
         {
             var res = DoOutInOp<object>(type, outAction);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/894057e5/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheMetricsImpl.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheMetricsImpl.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheMetricsImpl.cs
index b5982f6..d42a76d 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheMetricsImpl.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheMetricsImpl.cs
@@ -17,8 +17,8 @@
 
 namespace Apache.Ignite.Core.Impl.Cache
 {
+    using Apache.Ignite.Core.Binary;
     using Apache.Ignite.Core.Cache;
-    using Apache.Ignite.Core.Portable;
 
     /// <summary>
     /// Cache metrics used to obtain statistics on cache.
@@ -29,7 +29,7 @@ namespace Apache.Ignite.Core.Impl.Cache
         /// Initializes a new instance of the <see cref="CacheMetricsImpl"/> class.
         /// </summary>
         /// <param name="reader">The reader.</param>
-        public CacheMetricsImpl(IPortableRawReader reader)
+        public CacheMetricsImpl(IBinaryRawReader reader)
         {
             CacheGets = reader.ReadLong();
             CachePuts = reader.ReadLong();

http://git-wip-us.apache.org/repos/asf/ignite/blob/894057e5/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/MutableCacheEntry.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/MutableCacheEntry.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/MutableCacheEntry.cs
index 2c69043..d1d2898 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/MutableCacheEntry.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/MutableCacheEntry.cs
@@ -157,7 +157,7 @@ namespace Apache.Ignite.Core.Impl.Cache
         Intact = 0,
         ValueSet = 1,
         Removed = 2,
-        ErrPortable = 3,
+        ErrBinary = 3,
         ErrString = 4
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/894057e5/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Query/AbstractQueryCursor.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Query/AbstractQueryCursor.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Query/AbstractQueryCursor.cs
index 0f4b5a3..55eb459 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Query/AbstractQueryCursor.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Query/AbstractQueryCursor.cs
@@ -22,8 +22,8 @@ namespace Apache.Ignite.Core.Impl.Cache.Query
     using System.Collections.Generic;
     using System.Diagnostics.CodeAnalysis;
     using Apache.Ignite.Core.Cache.Query;
-    using Apache.Ignite.Core.Impl.Portable;
-    using Apache.Ignite.Core.Impl.Portable.IO;
+    using Apache.Ignite.Core.Impl.Binary;
+    using Apache.Ignite.Core.Impl.Binary.IO;
     using Apache.Ignite.Core.Impl.Unmanaged;
     using UU = Apache.Ignite.Core.Impl.Unmanaged.UnmanagedUtils;
 
@@ -41,8 +41,8 @@ namespace Apache.Ignite.Core.Impl.Cache.Query
         /** Position before head. */
         private const int BatchPosBeforeHead = -1;
 
-        /** Keep portable flag. */
-        private readonly bool _keepPortable;
+        /** Keep binary flag. */
+        private readonly bool _keepBinary;
 
         /** Wherther "GetAll" was called. */
         private bool _getAllCalled;
@@ -61,11 +61,11 @@ namespace Apache.Ignite.Core.Impl.Cache.Query
         /// </summary>
         /// <param name="target">Target.</param>
         /// <param name="marsh">Marshaller.</param>
-        /// <param name="keepPortable">Keep portable flag.</param>
-        protected AbstractQueryCursor(IUnmanagedTarget target, PortableMarshaller marsh, bool keepPortable) : 
+        /// <param name="keepBinary">Keep binary flag.</param>
+        protected AbstractQueryCursor(IUnmanagedTarget target, Marshaller marsh, bool keepBinary) : 
             base(target, marsh)
         {
-            _keepPortable = keepPortable;
+            _keepBinary = keepBinary;
         }
 
         #region Public methods
@@ -199,12 +199,12 @@ namespace Apache.Ignite.Core.Impl.Cache.Query
         /// </summary>
         /// <param name="reader">Reader.</param>
         /// <returns>Entry.</returns>
-        protected abstract T Read(PortableReaderImpl reader);
+        protected abstract T Read(BinaryReader reader);
 
         /** <inheritdoc /> */
-        protected override T1 Unmarshal<T1>(IPortableStream stream)
+        protected override T1 Unmarshal<T1>(IBinaryStream stream)
         {
-            return Marshaller.Unmarshal<T1>(stream, _keepPortable);
+            return Marshaller.Unmarshal<T1>(stream, _keepBinary);
         }
 
         /// <summary>
@@ -220,11 +220,11 @@ namespace Apache.Ignite.Core.Impl.Cache.Query
         /// <summary>
         /// Converter for GET_ALL operation.
         /// </summary>
-        /// <param name="stream">Portable stream.</param>
+        /// <param name="stream">Stream.</param>
         /// <returns>Result.</returns>
-        private IList<T> ConvertGetAll(IPortableStream stream)
+        private IList<T> ConvertGetAll(IBinaryStream stream)
         {
-            var reader = Marshaller.StartUnmarshal(stream, _keepPortable);
+            var reader = Marshaller.StartUnmarshal(stream, _keepBinary);
 
             var size = reader.ReadInt();
 
@@ -239,11 +239,11 @@ namespace Apache.Ignite.Core.Impl.Cache.Query
         /// <summary>
         /// Converter for GET_BATCH operation.
         /// </summary>
-        /// <param name="stream">Portable stream.</param>
+        /// <param name="stream">Stream.</param>
         /// <returns>Result.</returns>
-        private T[] ConvertGetBatch(IPortableStream stream)
+        private T[] ConvertGetBatch(IBinaryStream stream)
         {
-            var reader = Marshaller.StartUnmarshal(stream, _keepPortable);
+            var reader = Marshaller.StartUnmarshal(stream, _keepBinary);
 
             var size = reader.ReadInt();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/894057e5/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Query/Continuous/ContinuousQueryFilter.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Query/Continuous/ContinuousQueryFilter.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Query/Continuous/ContinuousQueryFilter.cs
index 5738ed9..7cdb91b 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Query/Continuous/ContinuousQueryFilter.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Query/Continuous/ContinuousQueryFilter.cs
@@ -18,7 +18,7 @@
 namespace Apache.Ignite.Core.Impl.Cache.Query.Continuous
 {
     using Apache.Ignite.Core.Cache.Event;
-    using Apache.Ignite.Core.Impl.Portable.IO;
+    using Apache.Ignite.Core.Impl.Binary.IO;
     using Apache.Ignite.Core.Impl.Resource;
     using CQU = ContinuousQueryUtils;
 
@@ -32,7 +32,7 @@ namespace Apache.Ignite.Core.Impl.Cache.Query.Continuous
         /// </summary>
         /// <param name="stream">Stream.</param>
         /// <returns>Result.</returns>
-        bool Evaluate(IPortableStream stream);
+        bool Evaluate(IBinaryStream stream);
 
         /// <summary>
         /// Inject grid.
@@ -60,8 +60,8 @@ namespace Apache.Ignite.Core.Impl.Cache.Query.Continuous
         /** Actual filter. */
         private readonly ICacheEntryEventFilter<TK, TV> _filter;
 
-        /** Keep portable flag. */
-        private readonly bool _keepPortable;
+        /** Keep binary flag. */
+        private readonly bool _keepBinary;
 
         /** Ignite hosting the filter. */
         private volatile Ignite _ignite;
@@ -73,17 +73,17 @@ namespace Apache.Ignite.Core.Impl.Cache.Query.Continuous
         /// Constructor.
         /// </summary>
         /// <param name="filter">Actual filter.</param>
-        /// <param name="keepPortable">Keep portable flag.</param>
-        public ContinuousQueryFilter(ICacheEntryEventFilter<TK, TV> filter, bool keepPortable)
+        /// <param name="keepBinary">Keep binary flag.</param>
+        public ContinuousQueryFilter(ICacheEntryEventFilter<TK, TV> filter, bool keepBinary)
         {
             _filter = filter;
-            _keepPortable = keepPortable;
+            _keepBinary = keepBinary;
         }
 
         /** <inheritDoc /> */
-        public bool Evaluate(IPortableStream stream)
+        public bool Evaluate(IBinaryStream stream)
         {
-            ICacheEntryEvent<TK, TV> evt = CQU.ReadEvent<TK, TV>(stream, _ignite.Marshaller, _keepPortable);
+            ICacheEntryEvent<TK, TV> evt = CQU.ReadEvent<TK, TV>(stream, _ignite.Marshaller, _keepBinary);
 
             return _filter.Evaluate(evt);
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/894057e5/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Query/Continuous/ContinuousQueryFilterHolder.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Query/Continuous/ContinuousQueryFilterHolder.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Query/Continuous/ContinuousQueryFilterHolder.cs
index a7cb245..9f357ea 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Query/Continuous/ContinuousQueryFilterHolder.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Query/Continuous/ContinuousQueryFilterHolder.cs
@@ -17,30 +17,30 @@
 
 namespace Apache.Ignite.Core.Impl.Cache.Query.Continuous
 {
-    using Apache.Ignite.Core.Impl.Portable;
-    using Apache.Ignite.Core.Portable;
+    using Apache.Ignite.Core.Binary;
+    using Apache.Ignite.Core.Impl.Binary;
 
     /// <summary>
-    /// Continuous query remote filter holder. Wraps real filter into portable object,
+    /// Continuous query remote filter holder. Wraps real filter into binary object,
     /// so that it can be passed over wire to another node.
     /// </summary>
-    public class ContinuousQueryFilterHolder : IPortableWriteAware
+    public class ContinuousQueryFilterHolder : IBinaryWriteAware
     {
         /** Filter object. */
         private readonly object _filter;
 
-        /** Keep portable flag. */
-        private readonly bool _keepPortable;
+        /** Keep binary flag. */
+        private readonly bool _keepBinary;
 
         /// <summary>
         /// Constructor.
         /// </summary>
         /// <param name="filter">Filter.</param>
-        /// <param name="keepPortable">Keep portable flag.</param>
-        public ContinuousQueryFilterHolder(object filter, bool keepPortable)
+        /// <param name="keepBinary">Keep binary flag.</param>
+        public ContinuousQueryFilterHolder(object filter, bool keepBinary)
         {
             _filter = filter;
-            _keepPortable = keepPortable;
+            _keepBinary = keepBinary;
         }
 
         /// <summary>
@@ -52,35 +52,35 @@ namespace Apache.Ignite.Core.Impl.Cache.Query.Continuous
         }
 
         /// <summary>
-        /// Keep portable flag.
+        /// Keep binary flag.
         /// </summary>
-        internal bool KeepPortable
+        internal bool KeepBinary
         {
-            get { return _keepPortable; }
+            get { return _keepBinary; }
         }
 
         /// <summary>
         /// Writes this object to the given writer.
         /// </summary>
         /// <param name="writer">Writer.</param>
-        public void WritePortable(IPortableWriter writer)
+        public void WriteBinary(IBinaryWriter writer)
         {
-            var rawWriter = (PortableWriterImpl) writer.GetRawWriter();
+            var rawWriter = (BinaryWriter) writer.GetRawWriter();
 
             rawWriter.WriteObject(_filter);
-            rawWriter.WriteBoolean(_keepPortable);
+            rawWriter.WriteBoolean(_keepBinary);
         }
 
         /// <summary>
         /// Initializes a new instance of the <see cref="ContinuousQueryFilterHolder"/> class.
         /// </summary>
         /// <param name="reader">The reader.</param>
-        public ContinuousQueryFilterHolder(IPortableReader reader)
+        public ContinuousQueryFilterHolder(IBinaryReader reader)
         {
-            var rawReader = (PortableReaderImpl) reader.GetRawReader();
+            var rawReader = (BinaryReader) reader.GetRawReader();
 
             _filter = rawReader.ReadObject<object>();
-            _keepPortable = rawReader.ReadBoolean();
+            _keepBinary = rawReader.ReadBoolean();
         }
     }
 }