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
| Method | Summary |
|---|---|
| Initialize | Initializes the repository, creating necessary storage structures if they don't exist. This method s... |
| AddDatasourceAsync | Adds a new datasource registration. |
| UpdateDatasourceAsync | Updates an existing datasource registration. Behaves like a patch. All NULL properties are ignored. |
| RemoveDatasourceAsync | Removes a datasource registration by ID. |
| GetDatasourcesAsync | Gets a list of all registered datasources and their metadata (excluding connection strings). |
| GetDatasourceAsync | Gets datasource information by ID (excluding connection string). |
| DatasourceExistsAsync | Checks if a datasource with the specified ID exists. |
| GetConnectionStringAsync | Gets 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.
void Initialize()AddDatasourceAsync
Adds a new datasource registration.
Task<bool> AddDatasourceAsync(DatasourceDto datasource)Parameters
- datasource (DatasourceDto) - The datasource to add.
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.
Task<bool> UpdateDatasourceAsync(DatasourceDto datasource)Parameters
- datasource (DatasourceDto) - The updated datasource information.
Returns
Type: Task<bool>
True if updated successfully, false if the datasource doesn't exist.
RemoveDatasourceAsync
Removes a datasource registration by ID.
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).
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).
Task<DatasourceDto?> 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.
Task<bool> DatasourceExistsAsync(string id)Parameters
- id (string) - The ID of the datasource to check.
Returns
Type: Task<bool>
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.
Task<string?> GetConnectionStringAsync(string id)Parameters
- id (string) - The ID of the datasource.
Returns
Type: Task<string?>
The connection string if found, null otherwise.