Skip to content

IDapperMaticAccessRepository ​

Namespace: MJCZone.DapperMatic.AspNetCore.Repositories

Assembly: MJCZone.DapperMatic.AspNetCore

Summary ​

Keeps the policies and tenants edited at runtime through DapperMatic's access endpoints, alongside those given in code and configuration: in memory (the default), in a file, or in a database table.

abstract public

Note: This is an interface that defines a contract. Look for implementing classes in the same or related namespaces.

Contents ​

Methods (10)

Methods ​

MethodSummary
GetAsyncReads every policy and tenant kept.
SavePolicyAsyncAdds a policy, or replaces the one of the same name and tenant: a tenant's policies have names of th...
DeletePolicyAsyncRemoves a policy.
SaveTenantAsyncAdds a tenant, or replaces the one of the same id.
DeleteTenantAsyncRemoves a tenant.
SaveWebhookAsyncAdds a webhook, or replaces the one of the same name and tenant.
DeleteWebhookAsyncRemoves a webhook.
SaveServiceAccountAsyncAdds a service account, or replaces the one of the same name and tenant.
DeleteServiceAccountAsyncRemoves a service account.
ReplaceAsyncReplaces everything kept, at once.

GetAsync ​

Reads every policy and tenant kept.

csharp
Task<DapperMaticAccessDocument> GetAsync(CancellationToken cancellationToken)

Parameters ​

  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task<DapperMaticAccessDocument>

The policies and tenants.

SavePolicyAsync ​

Adds a policy, or replaces the one of the same name and tenant: a tenant's policies have names of their own.

csharp
Task SavePolicyAsync(DmPolicy policy, CancellationToken cancellationToken)

Parameters ​

  • policy (DmPolicy) - The policy, which has a name, and a tenant if it is one of a tenant's.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task

A task.

DeletePolicyAsync ​

Removes a policy.

csharp
Task&lt;bool&gt; DeletePolicyAsync(
    string name,
    string tenant,
    CancellationToken cancellationToken)

Parameters ​

  • name (string) - The policy's name.
  • tenant (string) - The tenant it is one of, or null for one of the whole application.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task&lt;bool&gt;

True if it was kept.

SaveTenantAsync ​

Adds a tenant, or replaces the one of the same id.

csharp
Task SaveTenantAsync(
    string id,
    DapperMaticTenantSettings tenant,
    CancellationToken cancellationToken)

Parameters ​

  • id (string) - The tenant's id.
  • tenant (DapperMaticTenantSettings) - What is known of it.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task

A task.

DeleteTenantAsync ​

Removes a tenant.

csharp
Task&lt;bool&gt; DeleteTenantAsync(string id, CancellationToken cancellationToken)

Parameters ​

  • id (string) - The tenant's id.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task&lt;bool&gt;

True if it was kept.

SaveWebhookAsync ​

Adds a webhook, or replaces the one of the same name and tenant.

csharp
Task SaveWebhookAsync(
    DapperMaticWebhook webhook,
    CancellationToken cancellationToken)

Parameters ​

  • webhook (DapperMaticWebhook) - The webhook, which has a name, and a tenant if it is one of a tenant's.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task

A task.

DeleteWebhookAsync ​

Removes a webhook.

csharp
Task&lt;bool&gt; DeleteWebhookAsync(
    string name,
    string tenant,
    CancellationToken cancellationToken)

Parameters ​

  • name (string) - The webhook's name.
  • tenant (string) - The tenant it is one of, or null for one of the whole application.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task&lt;bool&gt;

True if it was kept.

SaveServiceAccountAsync ​

Adds a service account, or replaces the one of the same name and tenant.

csharp
Task SaveServiceAccountAsync(
    DapperMaticServiceAccount account,
    CancellationToken cancellationToken)

Parameters ​

  • account (DapperMaticServiceAccount) - The account, which has a name, and a tenant if it is one of a tenant's.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task

A task.

DeleteServiceAccountAsync ​

Removes a service account.

csharp
Task&lt;bool&gt; DeleteServiceAccountAsync(
    string name,
    string tenant,
    CancellationToken cancellationToken)

Parameters ​

  • name (string) - The account's name.
  • tenant (string) - The tenant it is one of, or null for one of the whole application.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task&lt;bool&gt;

True if it was kept.

ReplaceAsync ​

Replaces everything kept, at once.

csharp
Task ReplaceAsync(
    DapperMaticAccessDocument document,
    CancellationToken cancellationToken)

Parameters ​

  • document (DapperMaticAccessDocument) - The policies and tenants to keep.
  • cancellationToken (CancellationToken) - The cancellation token.

Returns ​

Type: Task

A task.