public bool FetchSubReportData(AspNetCore.ReportingServices.ReportIntermediateFormat.SubReport subReport, AspNetCore.ReportingServices.ReportIntermediateFormat.SubReportInstance subReportInstance)
        {
            AspNetCore.ReportingServices.ReportIntermediateFormat.ReportInstance reportInstance = subReportInstance.ReportInstance.Value();
            reportInstance.ResetReportVariables(subReport.OdpContext);
            bool flag;

            try
            {
                this.FetchData(reportInstance, subReport.MergeTransactions);
                if (subReport.OdpContext.ReprocessSnapshot && reportInstance.IsMissingExpectedDataChunk(subReport.OdpContext))
                {
                    flag = false;
                }
                else
                {
                    if (subReport.OdpContext.ReprocessSnapshot && !subReport.InDataRegion)
                    {
                        Merge.PreProcessTablixes(subReport.Report, subReport.OdpContext, false);
                    }
                    flag = true;
                }
            }
            catch (ProcessingAbortedException)
            {
                flag = false;
            }
            if (flag)
            {
                reportInstance.CalculateAndStoreReportVariables(subReport.OdpContext);
            }
            return(flag);
        }
        private bool IsTextboxInScope()
        {
            OnDemandProcessingContext odpContext      = base.m_reportRT.ReportObjectModel.OdpContext;
            IRIFReportScope           iRIFReportScope = null;

            if (odpContext.IsTablixProcessingMode)
            {
                iRIFReportScope = odpContext.LastTablixProcessingReportScope;
                if (iRIFReportScope == null)
                {
                    iRIFReportScope = odpContext.ReportDefinition;
                }
            }
            else if (odpContext.IsTopLevelSubReportProcessing)
            {
                AspNetCore.ReportingServices.ReportIntermediateFormat.SubReport subReport = odpContext.LastRIFObject as AspNetCore.ReportingServices.ReportIntermediateFormat.SubReport;
                Global.Tracer.Assert(subReport != null, "Missing reference to subreport object");
                iRIFReportScope = subReport.GetContainingSection(odpContext);
            }
            else
            {
                IReportScope currentReportScope = odpContext.CurrentReportScope;
                iRIFReportScope = ((currentReportScope == null) ? odpContext.ReportDefinition : currentReportScope.RIFReportScope);
            }
            if (iRIFReportScope != null && iRIFReportScope.TextboxInScope(this.m_textBox.SequenceID))
            {
                return(true);
            }
            return(false);
        }
        private void CheckRetrievalStatus(AspNetCore.ReportingServices.ReportIntermediateFormat.SubReport.Status status)
        {
            AspNetCore.ReportingServices.ReportIntermediateFormat.SubReport subReport = (AspNetCore.ReportingServices.ReportIntermediateFormat.SubReport)base.m_reportItemDef;
            switch (status)
            {
            case AspNetCore.ReportingServices.ReportIntermediateFormat.SubReport.Status.NotRetrieved:
            case AspNetCore.ReportingServices.ReportIntermediateFormat.SubReport.Status.DefinitionRetrieveFailed:
                this.m_errorCode    = SubReportErrorCodes.MissingSubReport;
                this.m_errorMessage = RPRes.rsMissingSubReport(subReport.Name, subReport.OriginalCatalogPath);
                break;

            case AspNetCore.ReportingServices.ReportIntermediateFormat.SubReport.Status.DataRetrieveFailed:
                this.m_errorCode    = SubReportErrorCodes.DataRetrievalFailed;
                this.m_errorMessage = RPRes.rsSubReportDataRetrievalFailed(subReport.Name, subReport.OriginalCatalogPath);
                break;

            case AspNetCore.ReportingServices.ReportIntermediateFormat.SubReport.Status.DataNotRetrieved:
                this.m_errorCode    = SubReportErrorCodes.DataNotRetrieved;
                this.m_errorMessage = RPRes.rsSubReportDataNotRetrieved(subReport.Name, subReport.OriginalCatalogPath);
                break;

            case AspNetCore.ReportingServices.ReportIntermediateFormat.SubReport.Status.ParametersNotSpecified:
                this.m_errorCode    = SubReportErrorCodes.ParametersNotSpecified;
                this.m_errorMessage = RPRes.rsSubReportParametersNotSpecified(subReport.Name, subReport.OriginalCatalogPath);
                break;

            default:
                this.m_errorCode    = SubReportErrorCodes.Success;
                this.m_errorMessage = null;
                break;
            }
            this.FinalizeErrorMessageAndThrow();
        }
Exemple #4
0
        public static bool InitializeSubReport(AspNetCore.ReportingServices.ReportIntermediateFormat.SubReport subReport)
        {
            bool result = false;
            OnDemandProcessingContext onDemandProcessingContext = null;

            try
            {
                onDemandProcessingContext = subReport.OdpContext;
                Merge merge = new Merge(subReport.Report, onDemandProcessingContext);
                result = merge.InitAndSetupSubReport(subReport);
                if (onDemandProcessingContext.ErrorContext.Messages != null)
                {
                    if (0 < onDemandProcessingContext.ErrorContext.Messages.Count)
                    {
                        OnDemandProcessingContext topLevelContext = onDemandProcessingContext.TopLevelContext;
                        topLevelContext.ErrorContext.Register(ProcessingErrorCode.rsWarningExecutingSubreport, Severity.Warning, subReport.ObjectType, subReport.Name, null, onDemandProcessingContext.ErrorContext.Messages);
                        return(result);
                    }
                    return(result);
                }
                return(result);
            }
            catch (Exception e)
            {
                AspNetCore.ReportingServices.ReportProcessing.ReportProcessing.HandleSubReportProcessingError(onDemandProcessingContext.TopLevelContext.ErrorContext, subReport, InstancePathItem.GenerateInstancePathString(subReport.InstancePath), onDemandProcessingContext.ErrorContext, e);
                return(result);
            }
        }
Exemple #5
0
 public UserSortFilterContext(UserSortFilterContext parentContext, AspNetCore.ReportingServices.ReportIntermediateFormat.SubReport subReport)
 {
     this.m_runtimeSortFilterInfo  = parentContext.RuntimeSortFilterInfo;
     this.m_dataSetGlobalID        = parentContext.DataSetGlobalId;
     this.m_inProcessUserSortPhase = parentContext.m_inProcessUserSortPhase;
     subReport.UpdateSubReportScopes(parentContext);
     this.m_containingScopes      = subReport.ContainingScopes;
     this.m_detailScopeSubReports = subReport.DetailScopeSubReports;
 }
        public bool InitAndSetupSubReport(AspNetCore.ReportingServices.ReportIntermediateFormat.SubReport subReport)
        {
            IReference <AspNetCore.ReportingServices.ReportIntermediateFormat.SubReportInstance> currentSubReportInstance = subReport.CurrentSubReportInstance;
            bool flag = this.InitSubReport(subReport, currentSubReportInstance);

            if (flag)
            {
                AspNetCore.ReportingServices.ReportIntermediateFormat.ReportInstance reportInstance = currentSubReportInstance.Value().ReportInstance.Value();
                this.m_odpContext.SetupEnvironment(reportInstance);
                this.m_odpContext.ReportObjectModel.UserImpl.UpdateUserProfileLocationWithoutLocking(UserProfileState.OnDemandExpressions);
                this.m_odpContext.IsUnrestrictedRenderFormatReferenceMode = true;
            }
            currentSubReportInstance.Value().Initialized = true;
            return(flag);
        }
        private RenderingContext GetOrCreateRenderingContext(AspNetCore.ReportingServices.ReportIntermediateFormat.SubReport subReport, AspNetCore.ReportingServices.ReportIntermediateFormat.ReportInstance reportInstance)
        {
            RenderingContext renderingContext = null;

            if (this.m_report == null)
            {
                renderingContext = new RenderingContext(base.m_renderingContext, subReport.OdpContext);
                this.m_report    = new Report(this, subReport.Report, reportInstance, renderingContext, subReport.ReportName, subReport.Description, base.m_inSubtotal);
            }
            else
            {
                renderingContext = this.m_report.RenderingContext;
                this.m_report.SetNewContext(reportInstance);
            }
            return(renderingContext);
        }
 private void CreateSubReportInstance(AspNetCore.ReportingServices.ReportIntermediateFormat.SubReport subReport, ScopeInstance parentInstance, OnDemandProcessingContext odpContext, IReference <IScope> owner)
 {
     if (!subReport.ExceededMaxLevel)
     {
         IReference <AspNetCore.ReportingServices.ReportIntermediateFormat.SubReportInstance> reference2 = subReport.CurrentSubReportInstance = AspNetCore.ReportingServices.ReportIntermediateFormat.SubReportInstance.CreateInstance(parentInstance, subReport, odpContext.OdpMetadata);
         subReport.OdpContext.UserSortFilterContext.CurrentContainingScope = owner;
         odpContext.LastTablixProcessingReportScope = parentInstance.RIFReportScope;
         if (SubReportInitializer.InitializeSubReport(subReport))
         {
             IReference <AspNetCore.ReportingServices.ReportIntermediateFormat.ReportInstance> reportInstance = reference2.Value().ReportInstance;
             Merge.PreProcessTablixes(subReport.Report, subReport.OdpContext, !odpContext.ReprocessSnapshot);
             if (subReport.Report.HasSubReports)
             {
                 SubReportInitializer.InitializeSubReports(subReport.Report, reportInstance.Value(), subReport.OdpContext, false, true);
             }
         }
         if (reference2 != null)
         {
             reference2.Value().InstanceComplete();
         }
         odpContext.EnsureCultureIsSetOnCurrentThread();
     }
 }
Exemple #9
0
        public override object PublishClone(AutomaticSubtotalContext context)
        {
            SubReport subReport = (SubReport)base.PublishClone(context);

            context.AddSubReport(subReport);
            if (this.m_reportPath != null)
            {
                subReport.m_reportPath = (string)this.m_reportPath.Clone();
            }
            if (this.m_parameters != null)
            {
                subReport.m_parameters = new List <ParameterValue>(this.m_parameters.Count);
                foreach (ParameterValue parameter in this.m_parameters)
                {
                    subReport.m_parameters.Add((ParameterValue)parameter.PublishClone(context));
                }
            }
            if (this.m_noRowsMessage != null)
            {
                subReport.m_noRowsMessage = (ExpressionInfo)this.m_noRowsMessage.PublishClone(context);
            }
            return(subReport);
        }
 public void RetrieveSubreport()
 {
     if (this.m_isNewContext)
     {
         if (base.m_isOldSnapshot)
         {
             AspNetCore.ReportingServices.ReportRendering.SubReport subReport = (AspNetCore.ReportingServices.ReportRendering.SubReport)base.m_renderReportItem;
             if (subReport.Report != null)
             {
                 if (this.m_report == null)
                 {
                     this.m_report = new Report(this, base.m_inSubtotal, subReport, base.m_renderingContext);
                 }
                 else
                 {
                     this.m_report.UpdateSubReportContents(this, subReport);
                 }
             }
             this.m_noRows             = subReport.NoRows;
             this.m_processedWithError = subReport.ProcessedWithError;
         }
         else
         {
             AspNetCore.ReportingServices.ReportIntermediateFormat.SubReport subReport2 = (AspNetCore.ReportingServices.ReportIntermediateFormat.SubReport)base.m_reportItemDef;
             RenderingContext renderingContext = null;
             try
             {
                 if (subReport2.ExceededMaxLevel)
                 {
                     this.m_errorCode    = SubReportErrorCodes.ExceededMaxRecursionLevel;
                     this.m_errorMessage = RPRes.rsExceededMaxRecursionLevel(subReport2.Name);
                     this.FinalizeErrorMessageAndThrow();
                 }
                 else
                 {
                     this.CheckRetrievalStatus(subReport2.RetrievalStatus);
                 }
                 if (base.m_renderingContext.InstanceAccessDisallowed)
                 {
                     renderingContext = this.GetOrCreateRenderingContext(subReport2, null);
                     renderingContext.SubReportHasNoInstance = true;
                 }
                 else
                 {
                     base.m_renderingContext.OdpContext.SetupContext(subReport2, base.Instance.ReportScopeInstance);
                     if (subReport2.CurrentSubReportInstance == null)
                     {
                         renderingContext = this.GetOrCreateRenderingContext(subReport2, null);
                         renderingContext.SubReportHasNoInstance = true;
                     }
                     else
                     {
                         AspNetCore.ReportingServices.ReportIntermediateFormat.SubReportInstance subReportInstance = subReport2.CurrentSubReportInstance.Value();
                         this.m_noRows             = subReportInstance.NoRows;
                         this.m_processedWithError = subReportInstance.ProcessedWithError;
                         if (this.m_processedWithError)
                         {
                             this.CheckRetrievalStatus(subReportInstance.RetrievalStatus);
                         }
                         AspNetCore.ReportingServices.ReportIntermediateFormat.ReportInstance reportInstance = subReportInstance.ReportInstance.Value();
                         renderingContext = this.GetOrCreateRenderingContext(subReport2, reportInstance);
                         renderingContext.OdpContext.LoadExistingSubReportDataChunkNameModifier(subReportInstance);
                         renderingContext.OdpContext.SetSubReportContext(subReportInstance, true);
                         reportInstance.SetupEnvironment(renderingContext.OdpContext);
                     }
                 }
             }
             catch (Exception e)
             {
                 this.m_processedWithError = true;
                 ErrorContext subReportErrorContext = null;
                 if (subReport2.OdpContext != null)
                 {
                     subReportErrorContext = subReport2.OdpContext.ErrorContext;
                 }
                 if (renderingContext == null && this.m_report != null)
                 {
                     renderingContext = this.m_report.RenderingContext;
                 }
                 AspNetCore.ReportingServices.ReportProcessing.ReportProcessing.HandleSubReportProcessingError(base.m_renderingContext.OdpContext.TopLevelContext.ErrorContext, subReport2, subReport2.UniqueName, subReportErrorContext, e);
             }
             if (renderingContext != null)
             {
                 renderingContext.SubReportProcessedWithError = this.m_processedWithError;
             }
         }
         if (this.m_processedWithError)
         {
             this.m_noRows = false;
             if (this.m_errorCode == SubReportErrorCodes.Success)
             {
                 this.m_errorCode    = SubReportErrorCodes.ProcessingError;
                 this.m_errorMessage = RPRes.rsRenderSubreportError;
             }
         }
         this.m_isNewContext = false;
     }
 }
        private bool InitSubReport(AspNetCore.ReportingServices.ReportIntermediateFormat.SubReport subReport, IReference <AspNetCore.ReportingServices.ReportIntermediateFormat.SubReportInstance> subReportInstanceRef)
        {
            bool flag = true;

            AspNetCore.ReportingServices.ReportIntermediateFormat.SubReportInstance subReportInstance = subReportInstanceRef.Value();
            if (this.m_odpContext.SnapshotProcessing && subReportInstance.ProcessedWithError)
            {
                return(false);
            }
            try
            {
                if (!this.m_odpContext.SnapshotProcessing)
                {
                    subReportInstance.RetrievalStatus = subReport.RetrievalStatus;
                }
                if (subReportInstance.RetrievalStatus == AspNetCore.ReportingServices.ReportIntermediateFormat.SubReport.Status.DefinitionRetrieveFailed)
                {
                    subReportInstance.ProcessedWithError = true;
                    return(false);
                }
                if (this.m_odpContext.CurrentReportInstance == null && subReport.Report != null)
                {
                    if (!this.m_odpContext.SnapshotProcessing)
                    {
                        subReport.OdpSubReportInfo.UserSortDataSetGlobalId = this.m_odpContext.ParentContext.UserSortFilterContext.DataSetGlobalId;
                    }
                    this.m_odpContext.UserSortFilterContext.UpdateContextForFirstSubreportInstance(this.m_odpContext.ParentContext.UserSortFilterContext);
                }
                if (this.m_odpContext.SnapshotProcessing && !this.m_odpContext.ReprocessSnapshot)
                {
                    AspNetCore.ReportingServices.ReportIntermediateFormat.ReportInstance reportInstance = subReportInstance.ReportInstance.Value();
                    this.m_odpContext.CurrentReportInstance = reportInstance;
                    this.m_odpContext.LoadExistingSubReportDataChunkNameModifier(subReportInstance);
                    reportInstance.InitializeFromSnapshot(this.m_odpContext);
                    this.Init(true, false);
                    this.m_odpContext.ThreadCulture = subReportInstance.ThreadCulture;
                    this.SetupReport(reportInstance);
                    this.m_odpContext.SetSubReportContext(subReportInstance, true);
                    this.m_odpContext.ReportRuntime.CustomCodeOnInit(this.m_odpContext.ReportDefinition);
                    this.m_odpContext.OdpMetadata.SetUpdatedVariableValues(this.m_odpContext, reportInstance);
                    return(flag);
                }
                AspNetCore.ReportingServices.ReportIntermediateFormat.ReportInstance reportInstance2 = this.PrepareReportInstance(subReportInstance);
                this.m_odpContext.CurrentReportInstance = reportInstance2;
                this.Init(true, false);
                subReportInstance.InstanceUniqueName = this.m_odpContext.CreateUniqueID().ToString(CultureInfo.InvariantCulture);
                this.m_odpContext.SetSubReportContext(subReportInstance, false);
                this.SetupReport(reportInstance2);
                this.m_parameters = OnDemandProcessingContext.EvaluateSubReportParameters(this.m_odpContext.ParentContext, subReport);
                bool flag2 = default(bool);
                if (!this.m_odpContext.SnapshotProcessing && !this.m_odpContext.ProcessWithCachedData)
                {
                    try
                    {
                        this.m_odpContext.ProcessReportParameters = true;
                        this.m_odpContext.ReportObjectModel.ParametersImpl.Clear();
                        AspNetCore.ReportingServices.ReportProcessing.ReportProcessing.ProcessReportParameters(subReport.Report, this.m_odpContext, this.m_parameters);
                    }
                    finally
                    {
                        this.m_odpContext.ProcessReportParameters = false;
                    }
                    if (!this.m_parameters.ValuesAreValid())
                    {
                        subReportInstance.RetrievalStatus = AspNetCore.ReportingServices.ReportIntermediateFormat.SubReport.Status.ParametersNotSpecified;
                        throw new ReportProcessingException(ErrorCode.rsParametersNotSpecified);
                    }
                    this.m_odpContext.ReportParameters = this.m_parameters;
                }
                else if (!this.m_parameters.ValuesAreValid(out flag2) && flag2)
                {
                    subReportInstance.RetrievalStatus = AspNetCore.ReportingServices.ReportIntermediateFormat.SubReport.Status.ParametersNotSpecified;
                    throw new ReportProcessingException(ErrorCode.rsParametersNotSpecified);
                }
                this.Init(this.m_parameters);
                subReportInstance.Parameters = new ParametersImpl(this.m_odpContext.ReportObjectModel.ParametersImpl);
                this.m_odpContext.SetSubReportNameModifierAndParameters(subReportInstance, !this.m_odpContext.SnapshotProcessing);
                if (this.m_odpContext.ReprocessSnapshot)
                {
                    reportInstance2.InitializeFromSnapshot(this.m_odpContext);
                }
                this.EvaluateReportLanguage(reportInstance2, null);
                subReportInstance.ThreadCulture = this.m_odpContext.ThreadCulture;
                if (!this.m_odpContext.SnapshotProcessing || this.m_odpContext.FoundExistingSubReportInstance)
                {
                    flag = this.FetchSubReportData(subReport, subReportInstance);
                    if (flag)
                    {
                        subReportInstance.RetrievalStatus = AspNetCore.ReportingServices.ReportIntermediateFormat.SubReport.Status.DataRetrieved;
                    }
                    else
                    {
                        subReportInstance.RetrievalStatus    = AspNetCore.ReportingServices.ReportIntermediateFormat.SubReport.Status.DataRetrieveFailed;
                        subReportInstance.ProcessedWithError = true;
                    }
                }
                else
                {
                    subReportInstance.RetrievalStatus    = AspNetCore.ReportingServices.ReportIntermediateFormat.SubReport.Status.DataNotRetrieved;
                    subReportInstance.ProcessedWithError = true;
                }
                this.m_odpContext.ReportParameters = null;
                return(flag);
            }
            catch (AspNetCore.ReportingServices.ReportProcessing.ReportProcessing.DataCacheUnavailableException)
            {
                throw;
            }
            catch (Exception ex2)
            {
                flag = false;
                subReportInstance.ProcessedWithError = true;
                if (subReportInstance.ReportInstance != null)
                {
                    subReportInstance.ReportInstance.Value().NoRows = false;
                }
                if (ex2 is RSException)
                {
                    this.m_odpContext.ErrorContext.Register((RSException)ex2, subReport.ObjectType);
                    return(flag);
                }
                return(flag);
            }
        }
Exemple #12
0
 private static OnDemandProcessingContext InitializeSubReport(OnDemandProcessingContext parentOdpContext, AspNetCore.ReportingServices.ReportIntermediateFormat.SubReport subReport, AspNetCore.ReportingServices.ReportIntermediateFormat.ReportInstance reportInstance, bool inDataRegion, bool fromCreateSubReportInstance, out bool prefetchSuccess)
 {
     Global.Tracer.Assert(null != subReport.OdpContext, "(null != subReport.OdpContext)");
     prefetchSuccess = true;
     if (!inDataRegion)
     {
         IReference <AspNetCore.ReportingServices.ReportIntermediateFormat.SubReportInstance> reference2 = subReport.CurrentSubReportInstance = ((subReport.OdpContext.SnapshotProcessing && !subReport.OdpContext.ReprocessSnapshot) ? reportInstance.SubreportInstances[subReport.IndexInCollection] : AspNetCore.ReportingServices.ReportIntermediateFormat.SubReportInstance.CreateInstance(reportInstance, subReport, parentOdpContext.OdpMetadata));
         if (!fromCreateSubReportInstance)
         {
             ReportSection containingSection = subReport.GetContainingSection(parentOdpContext);
             parentOdpContext.SetupContext(containingSection, null);
         }
         Merge merge = new Merge(subReport.Report, subReport.OdpContext);
         prefetchSuccess = merge.InitAndSetupSubReport(subReport);
     }
     return(subReport.OdpContext);
 }
Exemple #13
0
 private SubReportInstance(SubReport subreport, OnDemandMetadata odpMetadata)
 {
     this.m_subReportDef   = subreport;
     this.m_reportInstance = odpMetadata.GroupTreeScalabilityCache.AllocateEmptyTreePartition <ReportInstance>(AspNetCore.ReportingServices.ReportIntermediateFormat.Persistence.ObjectType.ReportInstanceReference);
 }
 public SubReport(IReportScope reportScope, IDefinitionPath parentDefinitionPath, int indexIntoParentCollectionDef, AspNetCore.ReportingServices.ReportIntermediateFormat.SubReport reportItemDef, RenderingContext renderingContext)
     : base(reportScope, parentDefinitionPath, indexIntoParentCollectionDef, reportItemDef, renderingContext)
 {
 }
 public void AddSubReport(AspNetCore.ReportingServices.ReportIntermediateFormat.SubReport subReport)
 {
     this.m_report.SubReports.Add(subReport);
 }
Exemple #16
0
        public override void Deserialize(IntermediateFormatReader reader)
        {
            reader.RegisterDeclaration(SubReportInstance.m_Declaration);
            while (reader.NextMember())
            {
                switch (reader.CurrentMember.MemberName)
                {
                case MemberName.SubReport:
                    this.m_subReportDef = reader.ReadGlobalReference <SubReport>();
                    break;

                case MemberName.Parameters:
                {
                    ParametersImplWrapper parametersImplWrapper = (ParametersImplWrapper)reader.ReadRIFObject();
                    if (parametersImplWrapper != null)
                    {
                        this.m_parameters = parametersImplWrapper.WrappedParametersImpl;
                    }
                    break;
                }

                case MemberName.ReportInstance:
                    this.m_reportInstance = (IReference <ReportInstance>)reader.ReadRIFObject();
                    break;

                case MemberName.DataSetUniqueName:
                    this.m_instanceUniqueName = reader.ReadString();
                    break;

                case MemberName.ThreadCulture:
                    this.m_threadCulture = reader.ReadCultureInfo();
                    break;

                case MemberName.Status:
                    this.m_status = (SubReport.Status)reader.ReadEnum();
                    break;

                case MemberName.ProcessedWithError:
                    this.m_processedWithError = reader.ReadBoolean();
                    break;

                case MemberName.IsInstanceShared:
                {
                    object obj2 = reader.ReadVariant();
                    if (obj2 != null)
                    {
                        this.m_isInstanceShared = (bool)obj2;
                    }
                    break;
                }

                case MemberName.DataChunkNameModifier:
                {
                    object obj = reader.ReadVariant();
                    if (obj != null)
                    {
                        this.m_dataChunkNameModifier = (int)obj;
                    }
                    break;
                }

                default:
                    Global.Tracer.Assert(false);
                    break;
                }
            }
        }
Exemple #17
0
        public static IReference <SubReportInstance> CreateInstance(ScopeInstance parentInstance, SubReport subReport, OnDemandMetadata odpMetadata)
        {
            SubReportInstance subReportInstance      = new SubReportInstance(subReport, odpMetadata);
            IReference <SubReportInstance> reference = odpMetadata.GroupTreeScalabilityCache.AllocateAndPin(subReportInstance, 0);

            subReportInstance.m_cleanupRef = (IDisposable)reference;
            parentInstance.AddChildScope((IReference <ScopeInstance>)reference, subReport.IndexInCollection);
            return(reference);
        }