Exemple #1
0
        public void D_WithPreload()
        {
            if (ReportId == 0)
            {
                ReportId = CodeNameResolver.GetInstance("AF_All Fields", "Report").Id;
            }

            using (new SecurityBypassContext())
                using (Profiler.Measure("D_WithPreload"))
                {
                    ReportHelpers.PreloadReport(ReportId);

                    var report = Entity.Get <Report>(ReportId);
                    var sq     = ReportToQueryConverter.Instance.Convert(report);
                }
        }
        public void TestPreload( )
        {
            // Find report
            IEntity   entity = CodeNameResolver.GetInstance("Forms", "Report");
            EntityRef field  = (new EntityRef("core:name"));
            EntityRef rel    = (new EntityRef("core:reportColumns"));
            var       report = entity.As <EDC.ReadiNow.Model.Report>( );

            // Clear caches
            TestHelpers.ClearServerCaches( );

            // Ensure empty
            Assert.IsFalse(EntityFieldCache.Instance.ContainsKey(entity.Id) && EntityFieldCache.Instance [entity.Id].ContainsField(field.Id), "Field false");
            Assert.IsFalse(EntityRelationshipCache.Instance.ContainsKey(new EntityRelationshipCacheKey(entity.Id, Direction.Forward)) &&
                           EntityRelationshipCache.Instance [new EntityRelationshipCacheKey(entity.Id, Direction.Forward)].ContainsKey(rel.Id), "Rel false");

            // Preload report
            ReportHelpers.PreloadReport(entity.Id);

            // Ensure present
            Assert.IsTrue(EntityFieldCache.Instance.ContainsKey(entity.Id) && EntityFieldCache.Instance [entity.Id].ContainsField(field.Id), "Field true");
            Assert.IsTrue(EntityRelationshipCache.Instance.ContainsKey(new EntityRelationshipCacheKey(entity.Id, Direction.Forward)) &&
                          EntityRelationshipCache.Instance [new EntityRelationshipCacheKey(entity.Id, Direction.Forward)].ContainsKey(rel.Id), "Rel true");
        }