public DataChunkReader(DataSetInstance dataSetInstance, OnDemandProcessingContext context, string chunkName) { this.m_recordSetSize = dataSetInstance.RecordSetSize; Global.Tracer.Assert(context.ChunkFactory != null && !string.IsNullOrEmpty(chunkName), "null != context.ChunkFactory && !String.IsNullOrEmpty(chunkName)"); string text = default(string); this.m_chunkStream = context.ChunkFactory.GetChunk(chunkName, AspNetCore.ReportingServices.ReportProcessing.ReportProcessing.ReportChunkTypes.Data, ChunkMode.Open, out text); Global.Tracer.Assert(this.m_chunkStream != null, "Missing Expected DataChunk with name: {0}", chunkName); this.m_chunkReader = new IntermediateFormatReader(this.m_chunkStream, (IRIFObjectCreator)(object)default(DataReaderRIFObjectCreator)); this.m_recordSetInfo = (RecordSetInfo)this.m_chunkReader.Value.ReadRIFObject(); if (context.IsSharedDataSetExecutionOnly || dataSetInstance.DataSetDef.IsReferenceToSharedDataSet) { DataChunkReader.CreateDataChunkFieldMapping(dataSetInstance, this.m_recordSetInfo, context.IsSharedDataSetExecutionOnly, out this.m_mappingIdentical, out this.m_mappingDataSetFieldIndexesToDataChunk); } this.m_firstRow = this.m_chunkStream.Position; if (-1 == this.m_recordSetSize) { this.m_streamLength = this.m_chunkStream.Length; Global.Tracer.Assert(this.m_streamLength >= this.m_firstRow, "(m_streamLength >= m_firstRow)"); } }
public static void CreateDataChunkFieldMapping(DataSetInstance currentDataSetInstance, RecordSetInfo recordSetInfo, bool isSharedDataSetExecutionReader, out bool mappingIdentical, out int[] mappingDataSetFieldIndexesToDataChunk) { mappingDataSetFieldIndexesToDataChunk = null; mappingIdentical = true; string[] fieldNames = recordSetInfo.FieldNames; RecordSetPropertyNamesList fieldPropertyNames = recordSetInfo.FieldPropertyNames; List <Field> fields = currentDataSetInstance.DataSetDef.Fields; bool flag = isSharedDataSetExecutionReader; if (fieldNames != null && fields != null) { int num = flag ? currentDataSetInstance.DataSetDef.Fields.Count : currentDataSetInstance.DataSetDef.NonCalculatedFieldCount; if (fieldPropertyNames != null && fieldPropertyNames.Count > 0) { currentDataSetInstance.FieldInfos = new FieldInfo[num]; } mappingIdentical = (fieldNames.Length == num); Dictionary <string, int> dictionary = new Dictionary <string, int>(StringComparer.Ordinal); for (int i = 0; i < fieldNames.Length; i++) { dictionary.Add(fieldNames[i], i); } int count = fields.Count; int num2 = 0; mappingDataSetFieldIndexesToDataChunk = new int[num]; for (int j = 0; j < count; j++) { if (!fields[j].IsCalculatedField || flag) { string key = fields[j].DataField; if (isSharedDataSetExecutionReader || fields[j].IsCalculatedField) { key = fields[j].Name; } int num3 = default(int); if (dictionary.TryGetValue(key, out num3)) { mappingDataSetFieldIndexesToDataChunk[num2] = num3; if (fieldPropertyNames != null && num3 < fieldPropertyNames.Count && fieldPropertyNames[num3] != null) { List <string> propertyNames = fieldPropertyNames.GetPropertyNames(num3); if (propertyNames != null) { currentDataSetInstance.FieldInfos[num2] = new FieldInfo(DataChunkReader.CreateSequentialIndexList(propertyNames.Count), propertyNames); } } if (num2 != num3) { mappingIdentical = false; } } else { mappingDataSetFieldIndexesToDataChunk[num2] = -1; mappingIdentical = false; } num2++; } } } }