public void RunCleanAccountAuditEntries(ISession session, ManagedSecurityContext sec) { IEnumerable <AccountAuditEntry> audit_entries = session.CreateQuery( string.Format( "FROM AccountAuditEntry AccountAuditEntry" + " WHERE AccountAuditEntry.Updated < '{0}'", DateTime.UtcNow.AddDays(-14).ToString(DateTimeFormatInfo.InvariantInfo))) .Enumerable <AccountAuditEntry>(); IEnumerator <AccountAuditEntry> enumerator = audit_entries.GetEnumerator(); while (enumerator.MoveNext() && !IsStopping) { AccountAuditEntry audit_entry = enumerator.Current; ManagedAccountAuditEntry ma = new ManagedAccountAuditEntry(session, audit_entry); ma.Delete(sec); session.Flush(); } }
public void RunCleanAccountAuditEntries(ISession session, ManagedSecurityContext sec) { IEnumerable<AccountAuditEntry> audit_entries = session.CreateQuery( string.Format( "FROM AccountAuditEntry AccountAuditEntry" + " WHERE AccountAuditEntry.Updated < '{0}'", DateTime.UtcNow.AddDays(-14).ToString(DateTimeFormatInfo.InvariantInfo))) .Enumerable<AccountAuditEntry>(); IEnumerator<AccountAuditEntry> enumerator = audit_entries.GetEnumerator(); while (enumerator.MoveNext() && ! IsStopping) { AccountAuditEntry audit_entry = enumerator.Current; ManagedAccountAuditEntry ma = new ManagedAccountAuditEntry(session, audit_entry); ma.Delete(sec); session.Flush(); } }