# Interface ILocalAuditService

Namespace
  adas_core.Application.Services.Interfaces

Assembly
  adas-core.Application.dll

    public interface ILocalAuditService

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

## Methods

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

Creates an asynchronous audit log entry capturing the original and modified data along with the user responsible for the change.

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

#### Parameters

`user` ClaimsPrincipal

  The claims principal representing the user who performed the action being audited. May be null if the action is performed by an unauthenticated or system context.

`dataOriginal` object

  The original state of the data before the change. May be null when the action creates a new record.

`dataModified` object

  The modified state of the data after the change. May be null when the action deletes an existing record.

`reason` string

  An optional explanation or justification for the change. Defaults to null when no reason is provided.

#### Returns

Task

  A task that represents the asynchronous creation of the audit log entry.

### DeepCopyAsync<T>(T)

Asynchronously creates a deep copy of the specified data, producing a new independent instance of the same type.

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

#### Parameters

`data` T

  The data instance to be deep copied.

#### Returns

Task<T>

  A task that represents the asynchronous operation, containing the deep-copied instance of type `T`, or `null` if the copy could not be produced.

#### Type Parameters

`T`