/// <summary> /// Copies the data from the clonable instance into the cloned instance ;) /// </summary> /// <param name="thisObj">The this object.</param> public void CopyTo(SBinaryDataListEntry thisObj) { // This is dangerous. We need to check for alias keys and use them instead ;) var keys = thisObj._myKeys; HashSet<int> gaps = keys.Gaps; int min = keys.MinValue; int max = keys.MaxValue; Columns = thisObj.Columns; _itemStorage = thisObj._itemStorage; // avoid referencing issues ;) _myKeys = new IndexList(gaps, max, min); DataListKey = thisObj.DataListKey; IsEmtpy = thisObj.IsEmtpy; IsRecordset = thisObj.IsRecordset; IsEvaluationScalar = thisObj.IsEvaluationScalar; Namespace = thisObj.Namespace; IsManagmentServicePayload = thisObj.IsManagmentServicePayload; _strToColIdx = thisObj._strToColIdx; _keyToAliasMap = thisObj._keyToAliasMap; }
/// <summary> /// Inits this instance. /// </summary> public void Init(int colCnt, bool createNewStorage = true) { if(createNewStorage) { _itemStorage = new BinaryDataListStorageLayer(); } // Construct the alias map for this entry ;) _keyToAliasMap = new Dictionary<string, BinaryDataListAlias>(); _myKeys = new IndexList(null, 1); _isEmpty = true; _internalReturnValue = new List<IBinaryDataListItem>(colCnt); // build the object we require to return data in ;) for(int i = 0; i < colCnt; i++) { _internalReturnValue.Add(new BinaryDataListItem(null, string.Empty)); if(Columns != null) { // Handle recordset _internalReturnValue[i].UpdateRecordset(Namespace); // always the same namespace ;) _internalReturnValue[i].UpdateField(Columns[i].ColumnName); // always the same column for this entry ;) } else { // Handle scalars _internalReturnValue[i].UpdateField(Namespace); // always the same namespace ;) } } // boot strap column cache ;) short cnt = 1; if(Columns != null) { cnt = (short)Columns.Count; } _strToColIdx = new Dictionary<string, int>(cnt); }