internal FieldsContext(ObjectModelImpl reportOM, DataSetCore dataSet)
 {
     Initialize(reportOM, new FieldsImpl(reportOM), dataSet, null, null, allFieldsCleared: true, pendingFieldValueUpdate: false, DataFieldRow.UnInitializedStreamOffset);
 }
        internal void UpdateFieldValues(ObjectModelImpl reportOM, bool useDataSetFieldsCache, bool reuseFieldObjects, Microsoft.ReportingServices.ReportIntermediateFormat.RecordRow row, DataSetInstance dataSetInstance, bool readerExtensionsSupported)
        {
            Global.Tracer.Assert(row != null, "Empty data row / no data reader");
            if (m_dataSetInstance != dataSetInstance)
            {
                m_dataSetInstance = dataSetInstance;
                m_dataSet         = dataSetInstance.DataSetDef.DataSetCore;
                if (m_dataSet.FieldsContext != null && useDataSetFieldsCache)
                {
                    m_fields = m_dataSet.FieldsContext.Fields;
                }
                else
                {
                    reuseFieldObjects = false;
                }
                m_dataReader              = null;
                m_lastRowOffset           = DataFieldRow.UnInitializedStreamOffset;
                m_pendingFieldValueUpdate = false;
            }
            m_allFieldsCleared = false;
            FieldInfo[] fieldInfos = dataSetInstance.FieldInfos;
            if (m_fields.ReaderExtensionsSupported && m_dataSet.InterpretSubtotalsAsDetails == Microsoft.ReportingServices.ReportIntermediateFormat.DataSet.TriState.False)
            {
                m_fields.IsAggregateRow        = row.IsAggregateRow;
                m_fields.AggregationFieldCount = row.AggregationFieldCount;
                if (!row.IsAggregateRow)
                {
                    m_fields.AggregationFieldCountForDetailRow = row.AggregationFieldCount;
                }
            }
            int num   = 0;
            int count = m_dataSet.Fields.Count;
            int num2  = row.RecordFields.Length;

            for (num = 0; num < num2; num++)
            {
                FieldImpl fieldImpl = reuseFieldObjects ? m_fields.GetFieldByIndex(num) : null;
                Microsoft.ReportingServices.ReportIntermediateFormat.Field       fieldDef    = m_dataSet.Fields[num];
                Microsoft.ReportingServices.ReportIntermediateFormat.RecordField recordField = row.RecordFields[num];
                if (recordField == null)
                {
                    if (!reuseFieldObjects || fieldImpl == null)
                    {
                        fieldImpl = new FieldImpl(reportOM, DataFieldStatus.IsMissing, null, fieldDef);
                    }
                    else
                    {
                        fieldImpl.UpdateValue(null, isAggregationField: false, DataFieldStatus.IsMissing, null);
                    }
                }
                else if (recordField.FieldStatus == DataFieldStatus.None)
                {
                    if (!reuseFieldObjects || fieldImpl == null)
                    {
                        fieldImpl = new FieldImpl(reportOM, recordField.FieldValue, recordField.IsAggregationField, fieldDef);
                    }
                    else
                    {
                        fieldImpl.UpdateValue(recordField.FieldValue, recordField.IsAggregationField, DataFieldStatus.None, null);
                    }
                }
                else if (!reuseFieldObjects || fieldImpl == null)
                {
                    fieldImpl = new FieldImpl(reportOM, recordField.FieldStatus, ReportRuntime.GetErrorName(recordField.FieldStatus, null), fieldDef);
                }
                else
                {
                    fieldImpl.UpdateValue(null, isAggregationField: false, recordField.FieldStatus, ReportRuntime.GetErrorName(recordField.FieldStatus, null));
                }
                if (recordField != null && fieldInfos != null)
                {
                    FieldInfo fieldInfo = fieldInfos[num];
                    if (fieldInfo != null && fieldInfo.PropertyCount != 0 && recordField.FieldPropertyValues != null)
                    {
                        for (int i = 0; i < fieldInfo.PropertyCount; i++)
                        {
                            fieldImpl.SetProperty(fieldInfo.PropertyNames[i], recordField.FieldPropertyValues[i]);
                        }
                    }
                }
                m_fields[num] = fieldImpl;
            }
            if (num >= count)
            {
                return;
            }
            if (!reuseFieldObjects && reportOM.OdpContext.ReportRuntime.ReportExprHost != null)
            {
                m_dataSet.SetExprHost(reportOM.OdpContext.ReportRuntime.ReportExprHost, reportOM);
            }
            for (; num < count; num++)
            {
                Microsoft.ReportingServices.ReportIntermediateFormat.Field fieldDef2 = m_dataSet.Fields[num];
                FieldImpl fieldImpl2 = reuseFieldObjects ? m_fields.GetFieldByIndex(num) : null;
                if (reuseFieldObjects && fieldImpl2 != null)
                {
                    if (!fieldImpl2.ResetCalculatedField())
                    {
                        CreateAndInitializeCalculatedFieldWrapper(reportOM, readerExtensionsSupported, m_dataSet, num, fieldDef2);
                    }
                }
                else
                {
                    CreateAndInitializeCalculatedFieldWrapper(reportOM, readerExtensionsSupported, m_dataSet, num, fieldDef2);
                }
            }
        }
 internal FieldsContext(ObjectModelImpl reportOM)
     : this(reportOM, null)
 {
 }
Exemple #4
0
 internal SecondaryFieldsCollectionWithAutomaticRestore(ObjectModelImpl reportOM, FieldsContext fieldsContext)
 {
     m_reportOM      = reportOM;
     m_fieldsContext = fieldsContext;
 }