public IList <object[]> GetRawRevisions(Type type, RevisionType revisionType, DateTime?startDate, DateTime?endDate)
        {
            IAuditQuery q = AuditReaderFactory.Get(Session).CreateQuery()
                            .ForRevisionsOfEntity(type, false, true)
                            .Add(AuditEntity.RevisionType().Eq(revisionType))
                            .AddOrder(AuditEntity.RevisionProperty("REVTSTMP").Desc());

            if (startDate.HasValue && endDate.HasValue)
            {
                q = q.Add(AuditEntity.RevisionProperty("REVTSTMP").Between(startDate, endDate));
            }
            return(q.GetResultList <object[]>());
        }
Beispiel #2
0
        public void VerifyRevisionPropertyRestriction()
        {
            var result = AuditReader().CreateQuery()
                         .ForRevisionsOfEntity(typeof(StrIntTestEntity), false, true)
                         .Add(AuditEntity.Id().Eq(id1))
                         .Add(AuditEntity.RevisionProperty("CustomTimestamp").Ge(timestamp))
                         .GetResultList();

            Assert.AreEqual(new StrIntTestEntity {
                Str = "c", Number = 10, Id = id1
            }, ((IList)result[0])[0]);
            var customRevEntity1 = ((IList)result[0])[1];

            Assert.IsInstanceOf <CustomRevEntity>(customRevEntity1);
            Assert.IsTrue(((CustomRevEntity)customRevEntity1).CustomTimestamp >= timestamp);
        }