# Class LocalAuditService

Namespace
  adas_core.Application.Services

Assembly
  adas-core.Application.dll

    public class LocalAuditService : ILocalAuditService

Inheritance
  object
  LocalAuditService

Implements
  ILocalAuditService

Inherited Members
  object.Equals(object)
  object.Equals(object, object)
  object.GetHashCode()
  object.GetType()
  object.MemberwiseClone()
  object.ReferenceEquals(object, object)
  object.ToString()

Extension Methods
  NumberUtils.IsNumber(object)
  NumberUtils.ToDouble(object)
  ObjectUtils.ToStr(object?)

## Constructors

### LocalAuditService(IAuditService, ILogger<LocalAuditService>)

    public LocalAuditService(IAuditService auditService, ILogger<LocalAuditService> logger)

#### Parameters

`auditService` IAuditService
`logger` ILogger<LocalAuditService>

## Methods

### CreateAuditLogAsync(ClaimsPrincipal?, object?, object?, string?)

Creates an audit log entry asynchronously, forwarding the provided data to the audit service with a reason when one is supplied, and logging any errors that occur.

    public Task CreateAuditLogAsync(ClaimsPrincipal? user, object? dataOriginal, object? dataModified, string? reason)

#### Parameters

`user` ClaimsPrincipal

  The claims principal representing the user performing the action; used to attribute the audit log entry.

`dataOriginal` object

  The original data before the change.

`dataModified` object

  The modified data after the change.

`reason` string

  An optional reason for the change; when null, the audit log is created without supplying a reason.

#### Returns

Task

### DeepCopyAsync<T>(T)

Asynchronously deep copies the specified data, attempting a primary copy method and falling back to a JSON-based copy if the primary fails. Returns the default value if both copy attempts fail.

    public Task<T?> DeepCopyAsync<T>(T data)

#### Parameters

`data` T

  The data to be deep copied.

#### Returns

Task<T>

  A task representing the asynchronous operation, containing the deep copy of the data, or `null` if both copy methods fail.

#### Type Parameters

`T`