Esempio n. 1
0
        public virtual async Task <Uri> SaveAuditRecord(AuditRecord record)
        {
            // Build an audit entry
            var entry = new AuditEntry(record, await GetActor());

            // Serialize to json
            string rendered = RenderAuditEntry(entry);

            // Save the record
            return(await SaveAuditRecord(rendered, record.GetResourceType(), record.GetPath(), record.GetAction(), entry.Actor.TimestampUtc));
        }
        public virtual async Task<Uri> SaveAuditRecord(AuditRecord record)
        {
            // Build an audit entry
            var entry = new AuditEntry(record, await GetActor());

            // Serialize to json
            string rendered = RenderAuditEntry(entry);

            // Save the record
            return await SaveAuditRecord(rendered, record.GetResourceType(), record.GetPath(), record.GetAction(), entry.Actor.TimestampUtc);
        }
        /// <summary>
        /// Persists the audit record to storage.
        /// </summary>
        /// <param name="record">An audit record.</param>
        /// <returns>A <see cref="Task"/> that represents the asynchronous save operation.</returns>
        /// <exception cref="ArgumentNullException">Thrown if <paramref name="record" /> is <c>null</c>.</exception>
        public async Task SaveAuditRecordAsync(AuditRecord record)
        {
            if (record == null)
            {
                throw new ArgumentNullException(nameof(record));
            }

            var entry    = new AuditEntry(record, await GetActorAsync());
            var rendered = RenderAuditEntry(entry);

            await SaveAuditRecordAsync(rendered, record.GetResourceType(), record.GetPath(), record.GetAction(), entry.Actor.TimestampUtc);
        }