FileDapperMaticDatasourceRepository
Namespace: MJCZone.DapperMatic.AspNetCore.Repositories
Assembly: MJCZone.DapperMatic.AspNetCore
Summary
File-based implementation of IDapperMaticDatasourceRepository that stores datasources in a JSON file with encrypted connection strings.
Inheritance
Base Class: DapperMaticDatasourceRepositoryBase
Implemented Interfaces:
- IDisposable
sealed public
Contents
Constructors (1) | Methods (15)
Constructors
FileDapperMaticDatasourceRepository
Initializes a new instance of the FileDapperMaticDatasourceRepository class.
FileDapperMaticDatasourceRepository(
string filePath,
IDatasourceIdFactory datasourceIdFactory,
DapperMaticOptions} options,
FileDapperMaticDatasourceRepository} logger)Parameters
- filePath (string) - The path to the JSON file where datasources will be stored.
- datasourceIdFactory (IDatasourceIdFactory) - The factory to generate datasource IDs.
- options (DapperMaticOptions}) - The DapperMatic options containing the encryption key.
- logger (FileDapperMaticDatasourceRepository}) - The logger instance.
Methods
| Method | Summary |
|---|---|
| Initialize | |
| AddDatasourceAsync | |
| UpdateDatasourceAsync | |
| RemoveDatasourceAsync | |
| GetDatasourcesAsync | |
| GetDatasourceAsync | |
| DatasourceExistsAsync | |
| GetConnectionStringAsync | |
| Dispose | Releases all resources used by the current instance of the FileDapperMaticDatasourceRepository cla... |
| EncryptConnectionString | Encrypts a connection string for secure storage. |
| DecryptConnectionString | /// Decrypts an encrypted connection string for internal use. |
| GetType | |
| ToString | |
| Equals | |
| GetHashCode |
Initialize
void Initialize()AddDatasourceAsync
Task<bool> AddDatasourceAsync()Returns
Type: Task<bool>
UpdateDatasourceAsync
Task<bool> UpdateDatasourceAsync()Returns
Type: Task<bool>
RemoveDatasourceAsync
Task<bool> RemoveDatasourceAsync()Returns
Type: Task<bool>
GetDatasourcesAsync
Task<List<DatasourceDto>> GetDatasourcesAsync()Returns
Type: Task<List<DatasourceDto>>
GetDatasourceAsync
Task<DatasourceDto?> GetDatasourceAsync()Returns
Type: Task<DatasourceDto?>
DatasourceExistsAsync
Task<bool> DatasourceExistsAsync()Returns
Type: Task<bool>
GetConnectionStringAsync
Task<string?> GetConnectionStringAsync()Returns
Type: Task<string?>
Dispose
Releases all resources used by the current instance of the FileDapperMaticDatasourceRepository class.
void Dispose()EncryptConnectionString
Encrypts a connection string for secure storage.
EncryptConnectionString(string connectionString)Parameters
- connectionString (string) - The plain text connection string.
Returns
The encrypted connection string.
DecryptConnectionString
/// Decrypts an encrypted connection string for internal use.
DecryptConnectionString(string encryptedConnectionString)Parameters
- encryptedConnectionString (string) - The encrypted connection string.
Returns
The decrypted plain text connection string.
GetType
GetType()ToString
ToString()Equals
Equals()GetHashCode
GetHashCode()