Example #1
0
        public void BinaryDataListRowEqualityComparer_Equals_MultipleColumns_NotMatchColumn_EqualReturnsFalse()
        {
            //------------Setup for test--------------------------
            var binaryDataListRowEqualityComparer = new BinaryDataListRowEqualityComparer(new List <int> {
                0, 1
            });

            var xValueRow = new IndexBasedBinaryDataListRow {
                Index = 1
            };
            var yValueRow = new IndexBasedBinaryDataListRow {
                Index = 1
            };
            var binaryDataListRow1 = new BinaryDataListRow(2);
            var binaryDataListRow2 = new BinaryDataListRow(2);

            binaryDataListRow1.UpdateValue("r1.f1.value", 0, 0);
            binaryDataListRow1.UpdateValue("test", 1, 0);
            binaryDataListRow2.UpdateValue("r1.f1.value", 0, 0);
            binaryDataListRow2.UpdateValue("test1", 1, 0);
            xValueRow.Row = binaryDataListRow1;
            yValueRow.Row = binaryDataListRow2;
            //------------Execute Test---------------------------
            var isEqual = binaryDataListRowEqualityComparer.Equals(xValueRow, yValueRow);

            //------------Assert Results-------------------------
            Assert.IsFalse(isEqual);
        }
        public void BinaryDataListRow_ProtoBuffDeserialize_NormalDeserialization_WithEmptyString_AllDataHydrated()
        {
            //------------Setup for test--------------------------

            BinaryDataListRow row1 = new BinaryDataListRow(5);

            row1.UpdateValue("col1", 0, 5);
            row1.UpdateValue("col2", 1, 5);
            row1.UpdateValue("", 2, 5);
            row1.UpdateValue("col4", 3, 5);
            row1.UpdateValue("col5", 4, 5);

            //------------Execute Test---------------------------
            var bytes = row1.ToByteArray();

            BinaryDataListRow row2 = new BinaryDataListRow(5);

            row2.ToObject(bytes);

            //------------Assert Results-------------------------
            var fetchValue = row2.FetchValue(2, 5);

            Assert.AreEqual("", fetchValue);
            Assert.IsNotNull(fetchValue);
        }
        public void Dev2BinaryStorage_BasicUsage_WhenAddingRemovingAtVolumn_AllDataFetched()
        {
            //------------Setup for test--------------------------
            Dev2BinaryStorage <BinaryDataListRow> dic = new Dev2BinaryStorage <BinaryDataListRow>(Guid.NewGuid().ToString(), 4194304); // 4MB buffer ;)

            const int cnt = 50000;

            IList <BinaryDataListRow> rows = new List <BinaryDataListRow>(cnt);
            IList <string>            keys = new List <string>();


            for (int i = 0; i < cnt; i++)
            {
                BinaryDataListRow row = new BinaryDataListRow(5);
                row.UpdateValue("col1" + Guid.NewGuid() + " " + Guid.NewGuid() + " " + Guid.NewGuid() + " " + Guid.NewGuid(), 0, 5);
                row.UpdateValue("col2", 1, 5);
                row.UpdateValue("col3" + Guid.NewGuid(), 2, 5);
                row.UpdateValue("col4", 3, 5);
                row.UpdateValue("col5" + Guid.NewGuid(), 4, 5);

                rows.Add(row);
                keys.Add(Guid.NewGuid().ToString());
            }

            //------------Execute Test---------------------------

            // add rows
            for (int i = 0; i < cnt; i++)
            {
                dic[keys[i]] = rows[i];

                // fake removals ;)
                if ((i + 1) % 100 == 0)
                {
                    dic.Remove(keys[i]);
                }

                // fake compact
                //if((i + 1) % 200 == 0)
                //{
                //    dic.Compact();
                //}
            }


            // check first and 2nd to last row, since last was removed ;)
            BinaryDataListRow fetchedRow1 = dic[keys[0]];
            BinaryDataListRow fetchedRow2 = dic[keys[cnt - 2]];

            //------------Assert Results-------------------------
            Assert.AreEqual("col2", fetchedRow1.FetchValue(1, 5));
            Assert.AreEqual("col4", fetchedRow1.FetchValue(3, 5));

            Assert.AreEqual("col2", fetchedRow2.FetchValue(1, 5));
            Assert.AreEqual("col4", fetchedRow2.FetchValue(3, 5));
        }
        public void Dev2BinaryStorage_BasicUsage_WhenAddingRemovingAndCompacting_AllDataFetched()
        {
            //------------Setup for test--------------------------
            Dev2BinaryStorage <BinaryDataListRow> dic = new Dev2BinaryStorage <BinaryDataListRow>(Guid.NewGuid().ToString(), 756);

            BinaryDataListRow row1 = new BinaryDataListRow(5);

            row1.UpdateValue("col1", 0, 5);
            row1.UpdateValue("col2", 1, 5);
            row1.UpdateValue("col3", 2, 5);
            row1.UpdateValue("col4", 3, 5);
            row1.UpdateValue("col5", 4, 5);

            BinaryDataListRow row3 = new BinaryDataListRow(5);

            row3.UpdateValue("col3", 2, 5);
            row3.UpdateValue("col4", 3, 5);
            row3.UpdateValue("col5", 4, 5);


            BinaryDataListRow row2 = new BinaryDataListRow(5);

            row1.UpdateValue("col1", 0, 5);
            row1.UpdateValue("col2", 1, 5);
            row1.UpdateValue("col3", 2, 5);
            row1.UpdateValue("col4", 3, 5);
            row1.UpdateValue("col5", 4, 5);

            string key1 = Guid.NewGuid().ToString();
            string key2 = Guid.NewGuid().ToString();
            string key3 = Guid.NewGuid().ToString();

            //------------Execute Test---------------------------
            dic[key3] = row3;
            dic[key2] = row2;
            dic[key1] = row1;

            dic.Remove(key2);
            dic.Compact();

            BinaryDataListRow fetchedRow1 = dic[key1];
            BinaryDataListRow fetchedRow3 = dic[key3];

            //------------Assert Results-------------------------
            Assert.AreEqual("col1", fetchedRow1.FetchValue(0, 5));
            Assert.AreEqual("col2", fetchedRow1.FetchValue(1, 5));
            Assert.AreEqual("col3", fetchedRow1.FetchValue(2, 5));
            Assert.AreEqual("col4", fetchedRow1.FetchValue(3, 5));
            Assert.AreEqual("col5", fetchedRow1.FetchValue(4, 5));


            Assert.AreEqual("col3", fetchedRow3.FetchValue(2, 5));
            Assert.AreEqual("col4", fetchedRow3.FetchValue(3, 5));
            Assert.AreEqual("col5", fetchedRow3.FetchValue(4, 5));
        }
        public void Dev2BinaryStorage_BasicUsage_WhenAddingAndRemovingAll_AllDataFetched()
        {
            //------------Setup for test--------------------------

            const int cnt = 10000;

            IList <BinaryDataListRow> rows = new List <BinaryDataListRow>(cnt);
            IList <string>            keys = new List <string>();

            List <Guid> theList = new List <Guid>();

            for (int i = 0; i < cnt; i++)
            {
                BinaryDataListRow row = new BinaryDataListRow(5);
                row.UpdateValue("col1" + Guid.NewGuid() + " " + Guid.NewGuid() + " " + Guid.NewGuid() + " " + Guid.NewGuid(), 0, 5);
                row.UpdateValue("col2", 1, 5);
                row.UpdateValue("col3" + Guid.NewGuid(), 2, 5);
                row.UpdateValue("col4", 3, 5);
                row.UpdateValue("col5" + Guid.NewGuid(), 4, 5);

                rows.Add(row);
                Guid key = Guid.NewGuid();
                keys.Add(key.ToString());
                theList.Add(key);
            }

            //------------Execute Test---------------------------

            // add rows
            //for(int i = 0; i < cnt; i++)
            //{
            //    dic[keys[i]] = rows[i];

            //    int itemsToRemove = dic.ItemCount;
            //    // fake removals ;)
            //    if((i + 1) % 100 == 0)
            //    {
            //        if(i == cnt-1)
            //        {
            //            Assert.AreEqual(38, dic.RemoveAll(theList));
            //        }
            //        else
            //        {
            //            Assert.AreEqual(itemsToRemove, dic.RemoveAll(theList));
            //        }
            //    }
            //}
        }
Example #6
0
        public void BinaryDataListRowEqualityComparer_Equals_StringValues_NotEqualReturnsFalse()
        {
            //------------Setup for test--------------------------
            var binaryDataListRowEqualityComparer = new BinaryDataListRowEqualityComparer(new List <int> {
                0
            });

            var xValueRow = new IndexBasedBinaryDataListRow {
                Index = 1
            };
            var yValueRow = new IndexBasedBinaryDataListRow {
                Index = 1
            };
            var binaryDataListRow1 = new BinaryDataListRow(1);
            var binaryDataListRow2 = new BinaryDataListRow(1);

            binaryDataListRow1.UpdateValue("r1.f1.value", 0, 0);
            binaryDataListRow2.UpdateValue("r1.f2.value", 0, 0);
            xValueRow.Row = binaryDataListRow1;
            yValueRow.Row = binaryDataListRow2;
            //------------Execute Test---------------------------
            var isEqual = binaryDataListRowEqualityComparer.Equals(xValueRow, yValueRow);

            //------------Assert Results-------------------------
            Assert.IsFalse(isEqual);
        }
Example #7
0
        public void BinaryDataListRowEqualityComparer_Equals_BothNotFloatValuesReturnsFalse()
        {
            //------------Setup for test--------------------------
            var binaryDataListRowEqualityComparer = new BinaryDataListRowEqualityComparer(new List <int> {
                0
            });

            var xValueRow = new IndexBasedBinaryDataListRow {
                Index = 1
            };
            var yValueRow = new IndexBasedBinaryDataListRow {
                Index = 1
            };
            var binaryDataListRow1 = new BinaryDataListRow(1);
            var binaryDataListRow2 = new BinaryDataListRow(1);

            binaryDataListRow1.UpdateValue("100.01", 0, 0);
            binaryDataListRow2.UpdateValue("some val", 0, 0);
            xValueRow.Row = binaryDataListRow1;
            yValueRow.Row = binaryDataListRow2;
            //------------Execute Test---------------------------
            var isEqual = binaryDataListRowEqualityComparer.Equals(xValueRow, yValueRow);

            //------------Assert Results-------------------------
            Assert.IsFalse(isEqual);
        }
Example #8
0
        public void BinaryDataListRowEqualityComparer_Equals_LongValues_EqualReturnsTrue()
        {
            //------------Setup for test--------------------------
            var binaryDataListRowEqualityComparer = new BinaryDataListRowEqualityComparer(new List <int> {
                0
            });

            var xValueRow = new IndexBasedBinaryDataListRow {
                Index = 1
            };
            var yValueRow = new IndexBasedBinaryDataListRow {
                Index = 1
            };
            var binaryDataListRow1 = new BinaryDataListRow(1);
            var binaryDataListRow2 = new BinaryDataListRow(1);

            binaryDataListRow1.UpdateValue("9223372036854775707", 0, 0);
            binaryDataListRow2.UpdateValue("9223372036854775707", 0, 0);
            xValueRow.Row = binaryDataListRow1;
            yValueRow.Row = binaryDataListRow2;
            //------------Execute Test---------------------------
            var isEqual = binaryDataListRowEqualityComparer.Equals(xValueRow, yValueRow);

            //------------Assert Results-------------------------
            Assert.IsTrue(isEqual);
        }
        public void BinaryDataListRow_ProtoBuffSerialize_NormalSerialization_AllDataConverted()
        {
            //------------Setup for test--------------------------

            BinaryDataListRow row1 = new BinaryDataListRow(5);

            row1.UpdateValue("col1", 0, 5);
            row1.UpdateValue("col2", 1, 5);
            row1.UpdateValue("col3", 2, 5);
            row1.UpdateValue("col4", 3, 5);
            row1.UpdateValue("col5", 4, 5);

            //------------Execute Test---------------------------
            var bytes = row1.ToByteArray();

            //------------Assert Results-------------------------
            Assert.AreEqual(92, bytes.Length);
        }
        public void CanFetchValueExpectValidRow()
        {
            Dev2BinaryStorage <BinaryDataListRow> dic = new Dev2BinaryStorage <BinaryDataListRow>(Guid.NewGuid().ToString(), 1024);

            BinaryDataListRow row1 = new BinaryDataListRow(5);

            row1.UpdateValue("col1", 0, 5);
            row1.UpdateValue("col2", 1, 5);
            row1.UpdateValue("col3", 2, 5);
            row1.UpdateValue("col4", 3, 5);
            row1.UpdateValue("col5", 4, 5);

            BinaryDataListRow row3 = new BinaryDataListRow(5);

            row3.UpdateValue("col3", 2, 5);
            row3.UpdateValue("col4", 3, 5);
            row3.UpdateValue("col5", 4, 5);


            string key1 = Guid.NewGuid().ToString();
            string key2 = Guid.NewGuid().ToString();
            string key3 = Guid.NewGuid().ToString();

            dic.Remove(key2);
            dic[key3] = row3;
            dic[key1] = row1;

            dic.Remove(key2);
            //dic.Compact();

            BinaryDataListRow fetchedRow1 = dic[key1];
            BinaryDataListRow fetchedRow3 = dic[key3];

            Assert.AreEqual("col1", fetchedRow1.FetchValue(0, 5));
            Assert.AreEqual("col2", fetchedRow1.FetchValue(1, 5));
            Assert.AreEqual("col3", fetchedRow1.FetchValue(2, 5));
            Assert.AreEqual("col4", fetchedRow1.FetchValue(3, 5));
            Assert.AreEqual("col5", fetchedRow1.FetchValue(4, 5));


            Assert.AreEqual("col3", fetchedRow3.FetchValue(2, 5));
            Assert.AreEqual("col4", fetchedRow3.FetchValue(3, 5));
            Assert.AreEqual("col5", fetchedRow3.FetchValue(4, 5));
        }
        public void CanRemoveFromFileExpectNoEntries()
        {
            Dev2BinaryStorage <BinaryDataListRow> dic = new Dev2BinaryStorage <BinaryDataListRow>(Guid.NewGuid().ToString(), 1024);

            BinaryDataListRow row = new BinaryDataListRow(5);

            row.UpdateValue("col1", 0, 5);
            row.UpdateValue("col2", 1, 5);
            row.UpdateValue("col3", 2, 5);
            row.UpdateValue("col4", 3, 5);
            row.UpdateValue("col5", 4, 5);

            string key = Guid.NewGuid().ToString();

            dic.Add(key, row);

            dic.Remove(key);

            Assert.AreEqual(0, dic.Count);
        }
        /// <summary>
        /// Adds the specified idx.
        /// </summary>
        /// <param name="idx">The idx.</param>
        /// <param name="cols">The cols.</param>
        public void Add(int idx, IList <IBinaryDataListItem> cols)
        {
            var colCnt = (short)cols.Count;

            BinaryDataListRow row = new BinaryDataListRow(colCnt);

            foreach (IBinaryDataListItem itm in cols)
            {
                row.UpdateValue(itm.TheValue, idx, colCnt);
            }
        }
        public void Dev2BinaryStorage_WhenBaseSmallerThanView_AllDataFetched()
        {
            // ------------Setup for test--------------------------
            Dev2BinaryStorage <BinaryDataListRow> dic = new Dev2BinaryStorage <BinaryDataListRow>(Guid.NewGuid().ToString(), 756);

            const int baseRowCount = 5;
            const int viewRowCount = 6;

            BinaryDataListRow row1 = new BinaryDataListRow(5);

            row1.UpdateValue("col1", 0, baseRowCount);
            row1.UpdateValue("col2", 1, baseRowCount);
            row1.UpdateValue("col3", 2, baseRowCount);
            row1.UpdateValue("col4", 3, baseRowCount);
            row1.UpdateValue("col5", 4, baseRowCount);

            string key1 = Guid.NewGuid().ToString();

            // ------------Execute Test---------------------------

            dic[key1] = row1;
            row1.UpdateValue("col6", 5, viewRowCount);
            dic[key1] = row1;

            BinaryDataListRow fetchedRow1 = dic[key1];

            // ------------Assert Results-------------------------
            Assert.AreEqual("col1", fetchedRow1.FetchValue(0, viewRowCount));
            Assert.AreEqual("col2", fetchedRow1.FetchValue(1, viewRowCount));
            Assert.AreEqual("col3", fetchedRow1.FetchValue(2, viewRowCount));
            Assert.AreEqual("col4", fetchedRow1.FetchValue(3, viewRowCount));
            Assert.AreEqual("col5", fetchedRow1.FetchValue(4, viewRowCount));
            Assert.AreEqual("col6", fetchedRow1.FetchValue(5, viewRowCount));
        }
        public void CanUseIndexerToAddExpectAddedEntry()
        {
            Dev2BinaryStorage <BinaryDataListRow> dic = new Dev2BinaryStorage <BinaryDataListRow>(Guid.NewGuid().ToString(), 1024);

            BinaryDataListRow row = new BinaryDataListRow(5);

            row.UpdateValue("col1", 0, 5);
            row.UpdateValue("col2", 1, 5);
            row.UpdateValue("col3", 2, 5);
            row.UpdateValue("col4", 3, 5);
            row.UpdateValue("col5", 4, 5);

            string key = Guid.NewGuid().ToString();

            dic[key] = row;

            Assert.AreEqual(1, dic.Keys.Count);
            var keyItr = dic.Keys.GetEnumerator();

            keyItr.MoveNext();
            Assert.AreEqual(key, keyItr.Current);
        }
        static BinaryDataListRow CreateBinaryDataListRow(string col1Value, string col2Value, string col3Value, string col4Value, string col5Value)
        {
            BinaryDataListRow row = new BinaryDataListRow(160);

            row.UpdateValue(col1Value, 0);
            row.UpdateValue(col2Value, 1);
            row.UpdateValue(col3Value, 2);
            row.UpdateValue(col4Value, 3);
            row.UpdateValue(col5Value, 4);
            row.UpdateValue(col1Value, 5);
            row.UpdateValue(col2Value, 6);
            row.UpdateValue(col3Value, 7);
            row.UpdateValue(col4Value, 8);
            row.UpdateValue(col5Value, 9);
            row.UpdateValue(col1Value, 10);
            row.UpdateValue(col2Value, 11);
            row.UpdateValue(col3Value, 12);
            row.UpdateValue(col4Value, 13);
            row.UpdateValue(col5Value, 14);
            row.UpdateValue(col1Value, 15);
            row.UpdateValue(col2Value, 16);
            row.UpdateValue(col3Value, 17);
            row.UpdateValue(col4Value, 18);
            row.UpdateValue(col5Value, 19);
            row.UpdateValue(col1Value, 20);
            row.UpdateValue(col2Value, 21);
            row.UpdateValue(col3Value, 22);
            row.UpdateValue(col4Value, 23);
            row.UpdateValue(col5Value, 24);
            row.UpdateValue(col1Value, 25);
            row.UpdateValue(col2Value, 26);
            row.UpdateValue(col3Value, 27);
            row.UpdateValue(col4Value, 28);
            row.UpdateValue(col5Value, 29);
            row.UpdateValue(col1Value, 30);
            row.UpdateValue(col2Value, 31);
            row.UpdateValue(col3Value, 32);
            row.UpdateValue(col4Value, 33);
            row.UpdateValue(col5Value, 34);
            row.UpdateValue(col1Value, 35);
            row.UpdateValue(col2Value, 36);
            row.UpdateValue(col3Value, 37);
            row.UpdateValue(col4Value, 38);
            row.UpdateValue(col5Value, 39);
            row.UpdateValue(col1Value, 40);
            row.UpdateValue(col2Value, 41);
            row.UpdateValue(col3Value, 42);
            row.UpdateValue(col4Value, 43);
            row.UpdateValue(col5Value, 44);
            row.UpdateValue(col1Value, 45);
            row.UpdateValue(col2Value, 46);
            row.UpdateValue(col3Value, 47);
            row.UpdateValue(col4Value, 48);
            row.UpdateValue(col5Value, 49);
            row.UpdateValue(col1Value, 50);
            row.UpdateValue(col2Value, 51);
            row.UpdateValue(col3Value, 52);
            row.UpdateValue(col4Value, 53);
            row.UpdateValue(col5Value, 54);
            row.UpdateValue(col1Value, 55);
            row.UpdateValue(col2Value, 56);
            row.UpdateValue(col3Value, 57);
            row.UpdateValue(col4Value, 58);
            row.UpdateValue(col5Value, 59);
            row.UpdateValue(col1Value, 60);
            row.UpdateValue(col2Value, 61);
            row.UpdateValue(col3Value, 62);
            row.UpdateValue(col4Value, 63);
            row.UpdateValue(col5Value, 64);
            row.UpdateValue(col1Value, 65);
            row.UpdateValue(col2Value, 66);
            row.UpdateValue(col3Value, 67);
            row.UpdateValue(col4Value, 68);
            row.UpdateValue(col5Value, 69);
            row.UpdateValue(col1Value, 70);
            row.UpdateValue(col2Value, 71);
            row.UpdateValue(col3Value, 72);
            row.UpdateValue(col4Value, 73);
            row.UpdateValue(col5Value, 74);
            row.UpdateValue(col1Value, 75);
            row.UpdateValue(col2Value, 76);
            row.UpdateValue(col3Value, 77);
            row.UpdateValue(col4Value, 78);
            row.UpdateValue(col5Value, 79);
            row.UpdateValue(col1Value, 80);
            row.UpdateValue(col2Value, 81);
            row.UpdateValue(col3Value, 82);
            row.UpdateValue(col4Value, 83);
            row.UpdateValue(col5Value, 84);
            row.UpdateValue(col1Value, 85);
            row.UpdateValue(col2Value, 86);
            row.UpdateValue(col3Value, 87);
            row.UpdateValue(col4Value, 88);
            row.UpdateValue(col5Value, 89);
            row.UpdateValue(col1Value, 90);
            row.UpdateValue(col2Value, 91);
            row.UpdateValue(col3Value, 92);
            row.UpdateValue(col4Value, 93);
            row.UpdateValue(col5Value, 94);
            row.UpdateValue(col1Value, 95);
            row.UpdateValue(col2Value, 96);
            row.UpdateValue(col3Value, 97);
            row.UpdateValue(col4Value, 98);
            row.UpdateValue(col5Value, 99);
            row.UpdateValue(col1Value, 100);
            row.UpdateValue(col2Value, 101);
            row.UpdateValue(col3Value, 102);
            row.UpdateValue(col4Value, 103);
            row.UpdateValue(col5Value, 104);
            row.UpdateValue(col1Value, 105);
            row.UpdateValue(col2Value, 106);
            row.UpdateValue(col3Value, 107);
            row.UpdateValue(col4Value, 108);
            row.UpdateValue(col5Value, 109);
            row.UpdateValue(col1Value, 110);
            row.UpdateValue(col2Value, 111);
            row.UpdateValue(col3Value, 112);
            row.UpdateValue(col4Value, 113);
            row.UpdateValue(col5Value, 114);
            row.UpdateValue(col1Value, 115);
            row.UpdateValue(col2Value, 116);
            row.UpdateValue(col3Value, 117);
            row.UpdateValue(col4Value, 118);
            row.UpdateValue(col5Value, 119);
            row.UpdateValue(col1Value, 120);
            row.UpdateValue(col2Value, 121);
            row.UpdateValue(col3Value, 122);
            row.UpdateValue(col4Value, 123);
            row.UpdateValue(col5Value, 124);
            row.UpdateValue(col1Value, 125);
            row.UpdateValue(col2Value, 126);
            row.UpdateValue(col3Value, 127);
            row.UpdateValue(col4Value, 128);
            row.UpdateValue(col5Value, 129);
            row.UpdateValue(col1Value, 130);
            row.UpdateValue(col2Value, 131);
            row.UpdateValue(col3Value, 132);
            row.UpdateValue(col4Value, 133);
            row.UpdateValue(col5Value, 134);
            row.UpdateValue(col1Value, 135);
            row.UpdateValue(col2Value, 136);
            row.UpdateValue(col3Value, 137);
            row.UpdateValue(col4Value, 138);
            row.UpdateValue(col5Value, 139);
            row.UpdateValue(col1Value, 140);
            row.UpdateValue(col2Value, 141);
            row.UpdateValue(col3Value, 142);
            row.UpdateValue(col4Value, 143);
            row.UpdateValue(col5Value, 144);
            row.UpdateValue(col1Value, 145);
            row.UpdateValue(col2Value, 146);
            row.UpdateValue(col3Value, 147);
            row.UpdateValue(col4Value, 148);
            row.UpdateValue(col5Value, 149);
            row.UpdateValue(col1Value, 150);
            row.UpdateValue(col2Value, 151);
            row.UpdateValue(col3Value, 152);
            row.UpdateValue(col4Value, 153);
            row.UpdateValue(col5Value, 154);
            row.UpdateValue(col1Value, 155);
            row.UpdateValue(col2Value, 156);
            row.UpdateValue(col3Value, 157);
            row.UpdateValue(col4Value, 158);
            row.UpdateValue(col5Value, 159);
            return row;
        }
        public IList <IBinaryDataListItem> this[int key, bool removeFromGaps = true]
        {
            get
            {
                if (key >= 0)
                {
                    ScrubInternalTo();

                    // Generate entry 1 key, generate entry 2 key.
                    var fetchKeys = GenerateFederatedKey(key);

                    short colCnt = 1;
                    if (Columns != null)
                    {
                        colCnt = (short)Columns.Count;
                    }

                    // I am going to look up all the different pieces then, push them together?!
                    foreach (var fedKey in fetchKeys.FetchAsList())
                    {
                        BinaryDataListRow theRow;
                        _itemStorage.TryGetValue(fedKey.TheKey, colCnt, out theRow);

                        if (theRow != null)
                        {
                            var myCols = fedKey.ImpactedColumns;

                            if (myCols != null)
                            {
                                foreach (var col in myCols)
                                {
                                    // Fetch index value
                                    var internalIdx = InternalFetchColumnIndex(col);

                                    // adjust if there is a mapping ;)
                                    // The datalist in the studio used to sort
                                    // hence we always had the correct ordering in the inner and outer xml shape
                                    // Now that this is not happening we need to account for swapped shapes
                                    // This code resolves an issue for certain cases but causes others to fail.
                                    // Need to find a better solution for the case it is trying to solve.


                                    // FOR : Bug_10247_Outter
                                    // if -1 skip and try next key ;)
                                    if (internalIdx != -1)
                                    {
                                        IBinaryDataListItem tmp = _internalReturnValue[internalIdx];

                                        //                                        if(keyAlias != null)
                                        //                                        {
                                        //                                            tmp.UpdateField(col);
                                        //                                        }

                                        // normal object build
                                        tmp.UpdateValue(theRow.FetchValue(internalIdx, colCnt));
                                        tmp.UpdateIndex(key);
                                    }
                                }
                            }
                            else
                            {
                                // we have a scalar value we are dealing with ;)
                                IBinaryDataListItem tmp = _internalReturnValue[0];
                                tmp.UpdateValue(theRow.FetchValue(0, 1));
                            }
                        }
                    }

                    return(_internalReturnValue);
                }

                return(null);
            }

            set
            {
                if (key >= 0)
                {
                    // we need to fetch federated parts if possible ;)
                    short colCnt = 1;
                    if (Columns != null)
                    {
                        colCnt = (short)Columns.Count;
                    }

                    var fetchKeys = GenerateFederatedKey(key);

                    BinaryDataListRow parentRow = null; // Master location
                    BinaryDataListRow childRow;         // Child location

                    // Fetch master location
                    if (fetchKeys.HasParentKey())
                    {
                        if (!_itemStorage.TryGetValue(fetchKeys.ParentKey.TheKey, colCnt, out parentRow))
                        {
                            throw new Exception("Fatal Internal DataList Storage Error");
                        }
                    }

                    // fetch child location
                    if (!_itemStorage.TryGetValue(fetchKeys.ChildKey.TheKey, colCnt, out childRow))
                    {
                        throw new Exception("Fatal Internal DataList Storage Error");
                    }

                    // we got the row object, now update it ;)
                    foreach (IBinaryDataListItem itm in value)
                    {
                        if (!string.IsNullOrEmpty(itm.FieldName))
                        {
                            int idx = InternalFetchColumnIndex(itm.FieldName); // Fetch correct index
                            BinaryDataListAlias keyAlias;

                            // adjust if there is a mapping ;)
                            if (_keyToAliasMap.TryGetValue(itm.FieldName, out keyAlias))
                            {
                                var parentColumns = keyAlias.MasterEntry.Columns;
                                var parentColumn  = keyAlias.MasterColumn;

                                idx = InternalParentFetchColumnIndex(parentColumn, parentColumns);

                                colCnt = (short)parentColumns.Count;
                            }

                            if (idx == -1 && !IsRecordset)
                            {
                                idx = 0; // adjust for scalar
                            }

                            if (idx >= 0)
                            {
                                // it is an alias mapping ;)
                                if (keyAlias != null)
                                {
                                    // alias update, use row 1
                                    if (parentRow != null)
                                    {
                                        try
                                        {
                                            parentRow.UpdateValue(itm.TheValue, idx, colCnt);
                                        }
                                        catch (Exception)
                                        {
                                            parentRow.UpdateValue(null, idx, colCnt);
                                        }
                                    }
                                }
                                else
                                {
                                    // normal update ;)
                                    try
                                    {
                                        childRow.UpdateValue(itm.TheValue, idx, colCnt);
                                    }
                                    catch (Exception)
                                    {
                                        childRow.UpdateValue(null, idx, colCnt);
                                    }
                                }
                            }
                        }
                    }

                    // adjust correctly ;)
                    if ((parentRow != null && !parentRow.IsEmpty) || (!childRow.IsEmpty))
                    {
                        _myKeys.SetMaxValue(key, IsEmtpy);
                    }
                    else
                    {
                        //we removed it?!
                        _myKeys.AddGap(key);
                    }

                    // update federated values ;)
                    if (parentRow != null)
                    {
                        // TODO : Make Faster, AND Adjust for when my view is different to the row's view!

                        // we need to signal master entry to update its view ;)
                        var me = fetchKeys.MasterEntry;
                        if (me != null)
                        {
                            me.AdjustIndexView(_myKeys.Gaps, _myKeys.GetMinIndex(), _myKeys.GetMaxIndex());
                        }

                        _itemStorage.TrySetValue(fetchKeys.ParentKey.TheKey, colCnt, parentRow);
                    }

                    if (childRow != null)
                    {
                        _itemStorage.TrySetValue(fetchKeys.ChildKey.TheKey, colCnt, childRow);
                    }
                }
            }
        }
        static BinaryDataListRow CreateBinaryDataListRow(string col1Value, string col2Value, string col3Value, string col4Value, string col5Value)
        {
            BinaryDataListRow row = new BinaryDataListRow(160);

            row.UpdateValue(col1Value, 0);
            row.UpdateValue(col2Value, 1);
            row.UpdateValue(col3Value, 2);
            row.UpdateValue(col4Value, 3);
            row.UpdateValue(col5Value, 4);
            row.UpdateValue(col1Value, 5);
            row.UpdateValue(col2Value, 6);
            row.UpdateValue(col3Value, 7);
            row.UpdateValue(col4Value, 8);
            row.UpdateValue(col5Value, 9);
            row.UpdateValue(col1Value, 10);
            row.UpdateValue(col2Value, 11);
            row.UpdateValue(col3Value, 12);
            row.UpdateValue(col4Value, 13);
            row.UpdateValue(col5Value, 14);
            row.UpdateValue(col1Value, 15);
            row.UpdateValue(col2Value, 16);
            row.UpdateValue(col3Value, 17);
            row.UpdateValue(col4Value, 18);
            row.UpdateValue(col5Value, 19);
            row.UpdateValue(col1Value, 20);
            row.UpdateValue(col2Value, 21);
            row.UpdateValue(col3Value, 22);
            row.UpdateValue(col4Value, 23);
            row.UpdateValue(col5Value, 24);
            row.UpdateValue(col1Value, 25);
            row.UpdateValue(col2Value, 26);
            row.UpdateValue(col3Value, 27);
            row.UpdateValue(col4Value, 28);
            row.UpdateValue(col5Value, 29);
            row.UpdateValue(col1Value, 30);
            row.UpdateValue(col2Value, 31);
            row.UpdateValue(col3Value, 32);
            row.UpdateValue(col4Value, 33);
            row.UpdateValue(col5Value, 34);
            row.UpdateValue(col1Value, 35);
            row.UpdateValue(col2Value, 36);
            row.UpdateValue(col3Value, 37);
            row.UpdateValue(col4Value, 38);
            row.UpdateValue(col5Value, 39);
            row.UpdateValue(col1Value, 40);
            row.UpdateValue(col2Value, 41);
            row.UpdateValue(col3Value, 42);
            row.UpdateValue(col4Value, 43);
            row.UpdateValue(col5Value, 44);
            row.UpdateValue(col1Value, 45);
            row.UpdateValue(col2Value, 46);
            row.UpdateValue(col3Value, 47);
            row.UpdateValue(col4Value, 48);
            row.UpdateValue(col5Value, 49);
            row.UpdateValue(col1Value, 50);
            row.UpdateValue(col2Value, 51);
            row.UpdateValue(col3Value, 52);
            row.UpdateValue(col4Value, 53);
            row.UpdateValue(col5Value, 54);
            row.UpdateValue(col1Value, 55);
            row.UpdateValue(col2Value, 56);
            row.UpdateValue(col3Value, 57);
            row.UpdateValue(col4Value, 58);
            row.UpdateValue(col5Value, 59);
            row.UpdateValue(col1Value, 60);
            row.UpdateValue(col2Value, 61);
            row.UpdateValue(col3Value, 62);
            row.UpdateValue(col4Value, 63);
            row.UpdateValue(col5Value, 64);
            row.UpdateValue(col1Value, 65);
            row.UpdateValue(col2Value, 66);
            row.UpdateValue(col3Value, 67);
            row.UpdateValue(col4Value, 68);
            row.UpdateValue(col5Value, 69);
            row.UpdateValue(col1Value, 70);
            row.UpdateValue(col2Value, 71);
            row.UpdateValue(col3Value, 72);
            row.UpdateValue(col4Value, 73);
            row.UpdateValue(col5Value, 74);
            row.UpdateValue(col1Value, 75);
            row.UpdateValue(col2Value, 76);
            row.UpdateValue(col3Value, 77);
            row.UpdateValue(col4Value, 78);
            row.UpdateValue(col5Value, 79);
            row.UpdateValue(col1Value, 80);
            row.UpdateValue(col2Value, 81);
            row.UpdateValue(col3Value, 82);
            row.UpdateValue(col4Value, 83);
            row.UpdateValue(col5Value, 84);
            row.UpdateValue(col1Value, 85);
            row.UpdateValue(col2Value, 86);
            row.UpdateValue(col3Value, 87);
            row.UpdateValue(col4Value, 88);
            row.UpdateValue(col5Value, 89);
            row.UpdateValue(col1Value, 90);
            row.UpdateValue(col2Value, 91);
            row.UpdateValue(col3Value, 92);
            row.UpdateValue(col4Value, 93);
            row.UpdateValue(col5Value, 94);
            row.UpdateValue(col1Value, 95);
            row.UpdateValue(col2Value, 96);
            row.UpdateValue(col3Value, 97);
            row.UpdateValue(col4Value, 98);
            row.UpdateValue(col5Value, 99);
            row.UpdateValue(col1Value, 100);
            row.UpdateValue(col2Value, 101);
            row.UpdateValue(col3Value, 102);
            row.UpdateValue(col4Value, 103);
            row.UpdateValue(col5Value, 104);
            row.UpdateValue(col1Value, 105);
            row.UpdateValue(col2Value, 106);
            row.UpdateValue(col3Value, 107);
            row.UpdateValue(col4Value, 108);
            row.UpdateValue(col5Value, 109);
            row.UpdateValue(col1Value, 110);
            row.UpdateValue(col2Value, 111);
            row.UpdateValue(col3Value, 112);
            row.UpdateValue(col4Value, 113);
            row.UpdateValue(col5Value, 114);
            row.UpdateValue(col1Value, 115);
            row.UpdateValue(col2Value, 116);
            row.UpdateValue(col3Value, 117);
            row.UpdateValue(col4Value, 118);
            row.UpdateValue(col5Value, 119);
            row.UpdateValue(col1Value, 120);
            row.UpdateValue(col2Value, 121);
            row.UpdateValue(col3Value, 122);
            row.UpdateValue(col4Value, 123);
            row.UpdateValue(col5Value, 124);
            row.UpdateValue(col1Value, 125);
            row.UpdateValue(col2Value, 126);
            row.UpdateValue(col3Value, 127);
            row.UpdateValue(col4Value, 128);
            row.UpdateValue(col5Value, 129);
            row.UpdateValue(col1Value, 130);
            row.UpdateValue(col2Value, 131);
            row.UpdateValue(col3Value, 132);
            row.UpdateValue(col4Value, 133);
            row.UpdateValue(col5Value, 134);
            row.UpdateValue(col1Value, 135);
            row.UpdateValue(col2Value, 136);
            row.UpdateValue(col3Value, 137);
            row.UpdateValue(col4Value, 138);
            row.UpdateValue(col5Value, 139);
            row.UpdateValue(col1Value, 140);
            row.UpdateValue(col2Value, 141);
            row.UpdateValue(col3Value, 142);
            row.UpdateValue(col4Value, 143);
            row.UpdateValue(col5Value, 144);
            row.UpdateValue(col1Value, 145);
            row.UpdateValue(col2Value, 146);
            row.UpdateValue(col3Value, 147);
            row.UpdateValue(col4Value, 148);
            row.UpdateValue(col5Value, 149);
            row.UpdateValue(col1Value, 150);
            row.UpdateValue(col2Value, 151);
            row.UpdateValue(col3Value, 152);
            row.UpdateValue(col4Value, 153);
            row.UpdateValue(col5Value, 154);
            row.UpdateValue(col1Value, 155);
            row.UpdateValue(col2Value, 156);
            row.UpdateValue(col3Value, 157);
            row.UpdateValue(col4Value, 158);
            row.UpdateValue(col5Value, 159);
            return(row);
        }