DefaultDataModelAuditor

Implements a data model auditor.

Namespace:
Inetdev.Auditing
Type:
Class
Public:
Yes
Protected:
No
Sealed:
Yes
Abstract:
No
Inherits from:
System.Object
Implements:
Inetdev.Data.IDataModelAuditor

Remarks

This implementation audit IDataModel objects only if they implement IIdentifiable.

Is the object implements ISecuredDataModel this implementation verfy audit records and generated security incidents if data tampering is detected.

Constructors

DefaultDataModelAuditor

Initializes a new instance of DefaultDataModelAuditor.

Signature:
public Void DefaultDataModelAuditor(auditingConnection, logger, currentPrincipal, currentTenantId)
Parameters
Name Type Summary
auditingConnection IDbAccess An IDbAccess interface for Auditing.
logger ILogger Diagnostics sub-system interface.
currentPrincipal ClaimsPrincipal A ClaimsPrincipal representing the user beeing audited.
currentTenantId Int32 Identification of the current Tenant.
Exceptions
Type Summary
ArgumentNullException

Thrown when auditingConnection is null.

-or-

When logger is null.

-or-

When currentPrincipal is null.

Properties

AuditingConnection

An IDbAccess interface for Auditing.

Signature:
public IDbAccess AuditingConnection { get; }

CurrentPrincipal

A ClaimsPrincipal representing the user beeing audited.

Signature:
public ClaimsPrincipal CurrentPrincipal { get; }

CurrentTenantId

Identification of the current Tenant.

Signature:
public Int32 CurrentTenantId { get; }

Logger

Diagnostics sub-system interface.

Signature:
public ILogger Logger { get; }

RequiresTransaction

Whether this auditor requires a database transaction.

Signature:
public Boolean RequiresTransaction { get; }

Methods

AfterDataAction

Writes an audit record to the audit repository.

Signature:
public Void AfterDataAction(model)
Parameters
Name Type Summary
model IDataModel An IIdentifiableIDataModel to be auditted.
Exceptions
Type Summary
ArgumentNullException Thrown when model is null.
SecurityException Thrown when there are error while generating audit data.
InvalidOperationException Thrown when a required fresh data could not be retrieved.

BeforeDataAction

Prepares the audit process and validates secured models as required.

Signature:
public Void BeforeDataAction(model)
Parameters
Name Type Summary
model IDataModel An IIdentifiableIDataModel object to audit.
Exceptions
Type Summary
ArgumentNullException Thrown when model is null.
SecurityIncidentException Thrown when a security incident is created.