private void SaveGeneratedReportItemInstance()
        {
            if (m_dynamicWidth != null || m_dynamicHeight != null)
            {
                return;
            }
            OnDemandProcessingContext odpContext = base.RenderingContext.OdpContext;

            Microsoft.ReportingServices.ReportIntermediateFormat.ReportSnapshot reportSnapshot = odpContext.OdpMetadata.ReportSnapshot;
            IChunkFactory chunkFactory = odpContext.ChunkFactory;

            if (CriDef.RepeatWith == null)
            {
                string text = CreateChunkName();
                using (Stream stream = chunkFactory.CreateChunk(text, Microsoft.ReportingServices.ReportProcessing.ReportProcessing.ReportChunkTypes.GeneratedReportItems, null))
                {
                    new IntermediateFormatWriter(stream, odpContext.GetActiveCompatibilityVersion()).Write(m_generatedReportItem.Instance);
                    stream.Flush();
                }
                reportSnapshot.AddGeneratedReportItemChunkName(GetGeneratedInstanceChunkKey(), text);
            }
            else
            {
                ImageInstance imageInstance = (ImageInstance)m_generatedReportItem.Instance;
                reportSnapshot.AddImageChunkName(name: imageInstance.StreamName = ImageHelper.StoreImageDataInChunk(Microsoft.ReportingServices.ReportProcessing.ReportProcessing.ReportChunkTypes.Image, imageInstance.ImageData, imageInstance.MIMEType, base.RenderingContext.OdpContext.OdpMetadata, base.RenderingContext.OdpContext.ChunkFactory), definitionKey: GetGeneratedInstanceChunkKey());
            }
        }
        protected override OnDemandMetadata PrepareMetadata()
        {
            OnDemandMetadata onDemandMetadata = new OnDemandMetadata(base.ReportDefinition);

            Microsoft.ReportingServices.ReportIntermediateFormat.ReportSnapshot reportSnapshot2 = onDemandMetadata.ReportSnapshot = new Microsoft.ReportingServices.ReportIntermediateFormat.ReportSnapshot(base.ReportDefinition, base.PublicProcessingContext.ReportContext.ItemName, base.PublicProcessingContext.Parameters, base.PublicProcessingContext.RequestUserName, m_executionTime, base.PublicProcessingContext.ReportContext.HostRootUri, base.PublicProcessingContext.ReportContext.ParentPath, base.PublicProcessingContext.UserLanguage.Name);
            return(onDemandMetadata);
        }
Пример #3
0
 internal RenderingContext(RenderingContext parentContext, OnDemandProcessingContext onDemandProcessingContext)
 {
     m_rendererID         = parentContext.m_rendererID;
     m_isSubReportContext = true;
     m_pageEvaluation     = null;
     m_dynamicInstances   = null;
     m_oldReportSnapshot  = parentContext.m_oldReportSnapshot;
     m_eventInfo          = parentContext.EventInfo;
     m_reportSnapshot     = parentContext.m_reportSnapshot;
     m_chunkManager       = parentContext.m_chunkManager;
     m_odpContext         = onDemandProcessingContext;
 }
Пример #4
0
 internal RenderingContext(string rendererID, Microsoft.ReportingServices.ReportIntermediateFormat.ReportSnapshot reportSnapshot, EventInformation eventInfo, OnDemandProcessingContext processingContext)
 {
     m_rendererID         = rendererID;
     m_isSubReportContext = false;
     m_reportSnapshot     = reportSnapshot;
     InitEventInfo(eventInfo);
     m_odpContext = processingContext;
     if (processingContext.ChunkFactory != null)
     {
         m_chunkManager = new RenderingChunkManager(rendererID, processingContext.ChunkFactory);
     }
 }
Пример #5
0
 internal RenderingContext(RenderingContext parentContext, bool hasReportItemReferences)
 {
     m_rendererID         = parentContext.m_rendererID;
     m_isSubReportContext = true;
     m_pageEvaluation     = null;
     m_dynamicInstances   = null;
     m_eventInfo          = parentContext.EventInfo;
     m_reportSnapshot     = parentContext.m_reportSnapshot;
     m_oldReportSnapshot  = parentContext.m_oldReportSnapshot;
     m_chunkManager       = parentContext.m_chunkManager;
     if (m_oldReportSnapshot != null)
     {
         m_odpContext = parentContext.OdpContext;
     }
     else
     {
         m_odpContext = new OnDemandProcessingContext(parentContext.m_odpContext, hasReportItemReferences, m_reportSnapshot.Report);
     }
 }
        private void GenerateReportItemDefinition()
        {
            m_generatedReportItem = null;
            ICustomReportItem controlInstance = base.RenderingContext.OdpContext.CriProcessingControls.GetControlInstance(CriDef.Type, base.RenderingContext.OdpContext.ExtFactory);

            if (controlInstance == null)
            {
                return;
            }
            try
            {
                controlInstance.GenerateReportItemDefinition(this);
            }
            catch (Exception ex)
            {
                base.RenderingContext.ErrorContext.Register(ProcessingErrorCode.rsCRIProcessingError, Severity.Warning, Name, Type);
                Global.Tracer.TraceException(TraceLevel.Error, RPRes.rsCRIProcessingError(Name, Type) + " " + ex.ToString());
                return;
            }
            if (m_generatedReportItem == null)
            {
                base.RenderingContext.ErrorContext.Register(ProcessingErrorCode.rsCRIRenderItemNull, Severity.Warning, CriDef.ObjectType, Name, Type);
                return;
            }
            m_generatedReportItem.ConstructReportItemDefinition();
            m_generatedReportItem.CriGenerationPhase = CriGenerationPhases.None;
            string text = CreateChunkName();
            OnDemandProcessingContext odpContext = base.RenderingContext.OdpContext;

            Microsoft.ReportingServices.ReportIntermediateFormat.ReportSnapshot reportSnapshot = odpContext.OdpMetadata.ReportSnapshot;
            using (Stream stream = odpContext.ChunkFactory.CreateChunk(text, Microsoft.ReportingServices.ReportProcessing.ReportProcessing.ReportChunkTypes.GeneratedReportItems, null))
            {
                IntermediateFormatWriter intermediateFormatWriter = new IntermediateFormatWriter(stream, odpContext.GetActiveCompatibilityVersion());
                Microsoft.ReportingServices.ReportIntermediateFormat.Visibility visibility = m_generatedReportItem.ReportItemDef.Visibility;
                m_generatedReportItem.ReportItemDef.Visibility = null;
                intermediateFormatWriter.Write(m_generatedReportItem.ReportItemDef);
                m_generatedReportItem.ReportItemDef.Visibility = visibility;
                stream.Flush();
            }
            reportSnapshot.AddGeneratedReportItemChunkName(GetGeneratedDefinitionChunkKey(), text);
        }
        private bool LoadGeneratedReportItemInstance()
        {
            Global.Tracer.Assert(m_generatedReportItem != null && m_generatedReportItem.Instance != null, "m_generatedReportItem != null && m_generatedReportItem.Instance != null");
            if (m_dynamicWidth != null || m_dynamicHeight != null)
            {
                return(false);
            }
            Microsoft.ReportingServices.ReportIntermediateFormat.ReportSnapshot reportSnapshot = base.RenderingContext.OdpContext.OdpMetadata.ReportSnapshot;
            string name;

            if (CriDef.RepeatWith != null)
            {
                if (!reportSnapshot.TryGetImageChunkName(GetGeneratedInstanceChunkKey(), out name))
                {
                    return(false);
                }
                ((ImageInstance)m_generatedReportItem.Instance).StreamName = name;
                return(true);
            }
            if (!reportSnapshot.TryGetGeneratedReportItemChunkName(GetGeneratedInstanceChunkKey(), out name))
            {
                return(false);
            }
            string mimeType;
            Stream chunk = base.RenderingContext.OdpContext.ChunkFactory.GetChunk(name, Microsoft.ReportingServices.ReportProcessing.ReportProcessing.ReportChunkTypes.GeneratedReportItems, ChunkMode.Open, out mimeType);

            if (chunk == null)
            {
                return(false);
            }
            using (chunk)
            {
                ROMInstanceObjectCreator rOMInstanceObjectCreator = new ROMInstanceObjectCreator(m_generatedReportItem.Instance);
                IntermediateFormatReader intermediateFormatReader = new IntermediateFormatReader(chunk, rOMInstanceObjectCreator, rOMInstanceObjectCreator);
                IPersistable             persistable = intermediateFormatReader.ReadRIFObject();
                Global.Tracer.Assert(persistable is ReportItemInstance, "reportItemInstance is ReportItemInstance");
                Global.Tracer.Assert(!intermediateFormatReader.HasReferences, "!reader.HasReferences");
            }
            return(true);
        }
Пример #8
0
 protected virtual OnDemandProcessingContext CreateOnDemandContext(OnDemandMetadata odpMetadata, Microsoft.ReportingServices.ReportIntermediateFormat.ReportSnapshot reportSnapshot, UserProfileState initialUserDependency)
 {
     return(new OnDemandProcessingContext(PublicProcessingContext, ReportDefinition, odpMetadata, m_errorContext, reportSnapshot.ExecutionTime, SnapshotProcessing, ReprocessSnapshot, ProcessWithCachedData, m_storeServerParameters, initialUserDependency, m_executionLogContext, Configuration, OnDemandProcessingMode, GetAbortHelper()));
 }
 protected override void PreProcessTablices(OnDemandProcessingContext odpContext, Microsoft.ReportingServices.ReportIntermediateFormat.ReportSnapshot reportSnapshot)
 {
     Merge.PreProcessTablixes(base.ReportDefinition, odpContext, onlyWithSubReports: false);
     reportSnapshot.SortFilterEventInfo = odpContext.NewSortFilterEventInfo;
 }
Пример #10
0
 protected override void PreProcessSnapshot(OnDemandProcessingContext odpContext, Merge odpMerge, Microsoft.ReportingServices.ReportIntermediateFormat.ReportInstance reportInstance, Microsoft.ReportingServices.ReportIntermediateFormat.ReportSnapshot reportSnapshot)
 {
     SetupInitialOdpState(odpContext, reportInstance, reportSnapshot);
 }
Пример #11
0
        public Microsoft.ReportingServices.ReportIntermediateFormat.ReportSnapshot Execute(out OnDemandProcessingContext odpContext)
        {
            ReportProcessingCompatibilityVersion.TraceCompatibilityVersion(m_configuration);
            odpContext = null;
            OnDemandMetadata onDemandMetadata = PrepareMetadata();

            onDemandMetadata.GlobalIDOwnerCollection = m_globalIDOwnerCollection;
            Microsoft.ReportingServices.ReportIntermediateFormat.ReportSnapshot reportSnapshot = onDemandMetadata.ReportSnapshot;
            Global.Tracer.Assert(reportSnapshot != null, "ReportSnapshot object must exist");
            try
            {
                UserProfileState userProfileState = UserProfileState.None;
                if (PublicProcessingContext.Parameters != null)
                {
                    userProfileState |= PublicProcessingContext.Parameters.UserProfileState;
                }
                odpContext = CreateOnDemandContext(onDemandMetadata, reportSnapshot, userProfileState);
                CompleteOdpContext(odpContext);
                Merge odpMerge;
                Microsoft.ReportingServices.ReportIntermediateFormat.ReportInstance reportInstance = CreateReportInstance(odpContext, onDemandMetadata, reportSnapshot, out odpMerge);
                PreProcessSnapshot(odpContext, odpMerge, reportInstance, reportSnapshot);
                odpContext.SnapshotProcessing = true;
                odpContext.IsUnrestrictedRenderFormatReferenceMode = true;
                ResetEnvironment(odpContext, reportInstance);
                if (odpContext.ThreadCulture != null)
                {
                    Thread.CurrentThread.CurrentCulture = odpContext.ThreadCulture;
                }
                UpdateUserProfileLocation(odpContext);
                return(reportSnapshot);
            }
            finally
            {
                CleanupAbortHandler(odpContext);
                if (odpContext != null && odpContext.GlobalDataSourceInfo != null && odpContext.GlobalDataSourceInfo.Values != null)
                {
                    foreach (ReportProcessing.DataSourceInfo value in odpContext.GlobalDataSourceInfo.Values)
                    {
                        if (value.TransactionInfo != null)
                        {
                            if (value.TransactionInfo.RollbackRequired)
                            {
                                if (Global.Tracer.TraceInfo)
                                {
                                    Global.Tracer.Trace(TraceLevel.Info, "Data source '{0}': Rolling back transaction.", value.DataSourceName.MarkAsModelInfo());
                                }
                                try
                                {
                                    value.TransactionInfo.Transaction.Rollback();
                                }
                                catch (Exception innerException)
                                {
                                    throw new ReportProcessingException(ErrorCode.rsErrorRollbackTransaction, innerException, value.DataSourceName.MarkAsModelInfo());
                                }
                            }
                            else
                            {
                                if (Global.Tracer.TraceVerbose)
                                {
                                    Global.Tracer.Trace(TraceLevel.Verbose, "Data source '{0}': Committing transaction.", value.DataSourceName.MarkAsModelInfo());
                                }
                                try
                                {
                                    value.TransactionInfo.Transaction.Commit();
                                }
                                catch (Exception innerException2)
                                {
                                    throw new ReportProcessingException(ErrorCode.rsErrorCommitTransaction, innerException2, value.DataSourceName.MarkAsModelInfo());
                                }
                            }
                        }
                        if (value.Connection != null)
                        {
                            try
                            {
                                odpContext.CreateAndSetupDataExtensionFunction.CloseConnection(value.Connection, value.ProcDataSourceInfo, value.DataExtDataSourceInfo);
                            }
                            catch (Exception innerException3)
                            {
                                throw new ReportProcessingException(ErrorCode.rsErrorClosingConnection, innerException3, value.DataSourceName.MarkAsModelInfo());
                            }
                        }
                    }
                }
            }
        }
Пример #12
0
 protected void SetupInitialOdpState(OnDemandProcessingContext odpContext, Microsoft.ReportingServices.ReportIntermediateFormat.ReportInstance reportInstance, Microsoft.ReportingServices.ReportIntermediateFormat.ReportSnapshot reportSnapshot)
 {
     reportSnapshot.HasUserSortFilter = ReportDefinition.ReportOrDescendentHasUserSortFilter;
     odpContext.SetupEnvironment(reportInstance);
 }
Пример #13
0
 protected abstract void PreProcessSnapshot(OnDemandProcessingContext odpContext, Merge odpMerge, Microsoft.ReportingServices.ReportIntermediateFormat.ReportInstance reportInstance, Microsoft.ReportingServices.ReportIntermediateFormat.ReportSnapshot reportSnapshot);
 protected override void PreProcessSnapshot(OnDemandProcessingContext odpContext, Merge odpMerge, Microsoft.ReportingServices.ReportIntermediateFormat.ReportInstance reportInstance, Microsoft.ReportingServices.ReportIntermediateFormat.ReportSnapshot reportSnapshot)
 {
     if (base.ReportDefinition.HasSubReports)
     {
         ReportProcessing.FetchSubReports(base.ReportDefinition, odpContext.ChunkFactory, odpContext.ErrorContext, odpContext.OdpMetadata, odpContext.ReportContext, odpContext.SubReportCallback, 0, odpContext.SnapshotProcessing, odpContext.ProcessWithCachedData, base.GlobalIDOwnerCollection, base.PublicProcessingContext.QueryParameters);
         SubReportInitializer.InitializeSubReportOdpContext(base.ReportDefinition, odpContext);
     }
     odpMerge.FetchData(reportInstance, mergeTransaction: false);
     reportInstance.CalculateAndStoreReportVariables(odpContext);
     if (base.ReportDefinition.HasSubReports)
     {
         SubReportInitializer.InitializeSubReports(base.ReportDefinition, reportInstance, odpContext, inDataRegion: false, fromCreateSubReportInstance: false);
     }
     SetupInitialOdpState(odpContext, reportInstance, reportSnapshot);
     if (base.ReportDefinition.HasSubReports || (!base.ReportDefinition.DeferVariableEvaluation && base.ReportDefinition.HasVariables))
     {
         Merge.PreProcessTablixes(base.ReportDefinition, odpContext, onlyWithSubReports: true);
     }
 }
 protected override void PreProcessSnapshot(OnDemandProcessingContext odpContext, Merge odpMerge, Microsoft.ReportingServices.ReportIntermediateFormat.ReportInstance reportInstance, Microsoft.ReportingServices.ReportIntermediateFormat.ReportSnapshot reportSnapshot)
 {
     SetupInitialOdpState(odpContext, reportInstance, reportSnapshot);
     if (base.ReportDefinition.HasSubReports)
     {
         SubReportInitializer.InitializeSubReportOdpContext(base.ReportDefinition, odpContext);
         SubReportInitializer.InitializeSubReports(base.ReportDefinition, reportInstance, odpContext, inDataRegion: false, fromCreateSubReportInstance: false);
     }
     PreProcessTablices(odpContext, reportSnapshot);
     reportInstance.CalculateAndStoreReportVariables(odpContext);
     odpContext.OdpMetadata.SetUpdatedVariableValues(odpContext, reportInstance);
 }
Пример #16
0
 internal FullOnDemandProcessingResult(Microsoft.ReportingServices.ReportIntermediateFormat.ReportSnapshot newOdpSnapshot, Microsoft.ReportingServices.ReportIntermediateFormat.Persistence.ChunkManager.OnDemandProcessingManager chunkManager, bool newOdpSnapshotChanged, IChunkFactory createChunkFactory, ParameterInfoCollection parameters, int autoRefresh, int numberOfPages, ProcessingMessageList warnings, bool eventInfoChanged, EventInformation newEventInfo, PaginationMode updatedPaginationMode, ReportProcessingFlags updatedProcessingFlags, UserProfileState usedUserProfileState, ExecutionLogContext executionLogContext)
     : base(createChunkFactory, newOdpSnapshot.DefinitionTreeHasDocumentMap, newOdpSnapshot.HasShowHide || newOdpSnapshot.HasUserSortFilter, parameters, autoRefresh, numberOfPages, warnings, eventInfoChanged, newEventInfo, updatedPaginationMode, updatedProcessingFlags, usedUserProfileState, executionLogContext)
 {
     m_chunkManager    = chunkManager;
     m_snapshotChanged = newOdpSnapshotChanged;
 }
        protected override OnDemandProcessingContext CreateOnDemandContext(OnDemandMetadata odpMetadata, Microsoft.ReportingServices.ReportIntermediateFormat.ReportSnapshot reportSnapshot, UserProfileState initialUserDependency)
        {
            OnDemandProcessingContext onDemandProcessingContext = new OnDemandProcessingContext(base.PublicProcessingContext, base.ReportDefinition, odpMetadata, base.ErrorContext, reportSnapshot.ExecutionTime, base.StoreServerParameters, initialUserDependency, base.ExecutionLogContext, base.Configuration, GetAbortHelper());

            onDemandProcessingContext.ReportObjectModel.Initialize(base.PublicProcessingContext.Parameters);
            return(onDemandProcessingContext);
        }
 protected override void PreProcessSnapshot(OnDemandProcessingContext odpContext, Merge odpMerge, Microsoft.ReportingServices.ReportIntermediateFormat.ReportInstance reportInstance, Microsoft.ReportingServices.ReportIntermediateFormat.ReportSnapshot reportSnapshot)
 {
     if (base.ReportDefinition.HasSubReports)
     {
         ReportProcessing.FetchSubReports(base.ReportDefinition, odpContext.ChunkFactory, odpContext.ErrorContext, odpContext.OdpMetadata, odpContext.ReportContext, odpContext.SubReportCallback, 0, odpContext.SnapshotProcessing, odpContext.ProcessWithCachedData, base.GlobalIDOwnerCollection, base.PublicProcessingContext.QueryParameters);
         SubReportInitializer.InitializeSubReportOdpContext(base.ReportDefinition, odpContext);
     }
 }
 protected override Microsoft.ReportingServices.ReportIntermediateFormat.ReportInstance CreateReportInstance(OnDemandProcessingContext odpContext, OnDemandMetadata odpMetadata, Microsoft.ReportingServices.ReportIntermediateFormat.ReportSnapshot reportSnapshot, out Merge odpMerge)
 {
     odpMerge = null;
     return(null);
 }
 protected virtual void PreProcessTablices(OnDemandProcessingContext odpContext, Microsoft.ReportingServices.ReportIntermediateFormat.ReportSnapshot reportSnapshot)
 {
 }
Пример #21
0
 protected virtual Microsoft.ReportingServices.ReportIntermediateFormat.ReportInstance CreateReportInstance(OnDemandProcessingContext odpContext, OnDemandMetadata odpMetadata, Microsoft.ReportingServices.ReportIntermediateFormat.ReportSnapshot reportSnapshot, out Merge odpMerge)
 {
     odpMerge = new Merge(ReportDefinition, odpContext);
     Microsoft.ReportingServices.ReportIntermediateFormat.Persistence.ChunkManager.OnDemandProcessingManager.EnsureGroupTreeStorageSetup(odpMetadata, odpContext.ChunkFactory, odpMetadata.GlobalIDOwnerCollection, openExisting: false, odpContext.GetActiveCompatibilityVersion(), odpContext.ProhibitSerializableValues);
     Microsoft.ReportingServices.ReportIntermediateFormat.ReportInstance reportInstance2 = odpContext.CurrentReportInstance = odpMerge.PrepareReportInstance(odpMetadata);
     Microsoft.ReportingServices.ReportIntermediateFormat.ReportInstance reportInstance4 = reportSnapshot.ReportInstance = reportInstance2;
     Microsoft.ReportingServices.ReportIntermediateFormat.ReportInstance reportInstance5 = reportInstance4;
     odpMerge.Init(PublicProcessingContext.Parameters);
     SetupReportLanguage(odpMerge, reportInstance5);
     odpMerge.SetupReport(reportInstance5);
     return(reportInstance5);
 }