Skip to content

IDapperMaticDatasourceRepository

Namespace: MJCZone.DapperMatic.AspNetCore.Repositories

Assembly: MJCZone.DapperMatic.AspNetCore

Summary

Repository for managing DapperMatic database datasource registrations. Provnamees secure storage where connection strings can be added/updated but never retrieved after insertion.

abstract public

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

Contents

Methods (8)

Methods

MethodSummary
InitializeInitializes the repository, creating necessary storage structures if they don't exist. This method s...
AddDatasourceAsyncAdds a new datasource registration.
UpdateDatasourceAsyncUpdates an existing datasource registration. Behaves like a patch. All NULL properties are ignored.
RemoveDatasourceAsyncRemoves a datasource registration by ID.
GetDatasourcesAsyncGets a list of all registered datasources and their metadata (excluding connection strings).
GetDatasourceAsyncGets datasource information by ID (excluding connection string).
DatasourceExistsAsyncChecks if a datasource with the specified ID exists.
GetConnectionStringAsyncGets a connection string for internal use by DapperMatic services. This method is for internal use o...

Initialize

Initializes the repository, creating necessary storage structures if they don't exist. This method should be called once during application startup.

csharp
void Initialize()

AddDatasourceAsync

Adds a new datasource registration.

csharp
Task<bool> AddDatasourceAsync(DatasourceDto datasource)

Parameters

Returns

Type: Task<bool>

True if added successfully, false if a datasource with the same ID already exists.

UpdateDatasourceAsync

Updates an existing datasource registration. Behaves like a patch. All NULL properties are ignored.

csharp
Task<bool> UpdateDatasourceAsync(DatasourceDto datasource)

Parameters

Returns

Type: Task<bool>

True if updated successfully, false if the datasource doesn't exist.

RemoveDatasourceAsync

Removes a datasource registration by ID.

csharp
Task<bool> RemoveDatasourceAsync(string id)

Parameters

  • id (string) - The ID of the datasource to remove.

Returns

Type: Task<bool>

True if removed successfully, false if the datasource doesn't exist.

GetDatasourcesAsync

Gets a list of all registered datasources and their metadata (excluding connection strings).

csharp
Task<List<DatasourceDto>> GetDatasourcesAsync(string tag)

Parameters

  • tag (string) - Optional tag to filter datasources by. If null, returns all datasources.

Returns

Type: Task<List<DatasourceDto>>

A collection of datasource information without connection strings.

GetDatasourceAsync

Gets datasource information by ID (excluding connection string).

csharp
Task&lt;DatasourceDto?&gt; GetDatasourceAsync(string id)

Parameters

  • id (string) - The ID of the datasource.

Returns

Type: Task<DatasourceDto?>

The datasource information without connection string, or null if not found.

DatasourceExistsAsync

Checks if a datasource with the specified ID exists.

csharp
Task&lt;bool&gt; DatasourceExistsAsync(string id)

Parameters

  • id (string) - The ID of the datasource to check.

Returns

Type: Task&lt;bool&gt;

True if the datasource exists, false otherwise.

GetConnectionStringAsync

Gets a connection string for internal use by DapperMatic services. This method is for internal use only and should not be exposed through APIs.

csharp
Task&lt;string?&gt; GetConnectionStringAsync(string id)

Parameters

  • id (string) - The ID of the datasource.

Returns

Type: Task&lt;string?&gt;

The connection string if found, null otherwise.