Skip to content

DatabaseDapperMaticDatasourceRepository ​

Namespace: MJCZone.DapperMatic.AspNetCore.Repositories

Assembly: MJCZone.DapperMatic.AspNetCore

Summary ​

Database-based implementation of IDapperMaticDatasourceRepository that stores datasources in a database table with encrypted connection strings.

Inheritance ​

Base Class: DapperMaticDatasourceRepositoryBase

sealed public

Contents ​

Constructors (1) | Methods (14)

Constructors ​

DatabaseDapperMaticDatasourceRepository ​

Initializes a new instance of the DatabaseDapperMaticDatasourceRepository class.

csharp
DatabaseDapperMaticDatasourceRepository(
    string provider,
    string connectionString,
    IDbConnectionFactory connectionFactory,
    IDatasourceIdFactory datasourceIdFactory,
    DapperMaticOptions} options,
    DatabaseDapperMaticDatasourceRepository} logger)

Parameters ​

  • provider (string) - The database provider for the repository storage.
  • connectionString (string) - The connection string for the repository database.
  • connectionFactory (IDbConnectionFactory) - The connection factory for creating database connections.
  • datasourceIdFactory (IDatasourceIdFactory) - The factory for generating datasource IDs.
  • options (DapperMaticOptions}) - The DapperMatic options containing the encryption key.
  • logger (DatabaseDapperMaticDatasourceRepository}) - The logger instance.

Methods ​

MethodSummary
Initialize
AddDatasourceAsync
UpdateDatasourceAsync
RemoveDatasourceAsync
GetDatasourcesAsync
GetDatasourceAsync
DatasourceExistsAsync
GetConnectionStringAsync
EncryptConnectionStringEncrypts a connection string for secure storage, with the current key, prefixed by that key's id.
DecryptConnectionStringDecrypts an encrypted connection string for internal use, with the key whose id it carries: the curr...
GetType
ToString
Equals
GetHashCode

Initialize ​

csharp
void Initialize()

AddDatasourceAsync ​

csharp
Task<bool> AddDatasourceAsync()

Returns ​

Type: Task<bool>

UpdateDatasourceAsync ​

csharp
Task<bool> UpdateDatasourceAsync()

Returns ​

Type: Task<bool>

RemoveDatasourceAsync ​

csharp
Task<bool> RemoveDatasourceAsync()

Returns ​

Type: Task<bool>

GetDatasourcesAsync ​

csharp
Task<List<DatasourceDto>> GetDatasourcesAsync()

Returns ​

Type: Task<List<DatasourceDto>>

GetDatasourceAsync ​

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

Returns ​

Type: Task<DatasourceDto?>

DatasourceExistsAsync ​

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

Returns ​

Type: Task&lt;bool&gt;

GetConnectionStringAsync ​

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

Returns ​

Type: Task&lt;string?&gt;

EncryptConnectionString ​

Encrypts a connection string for secure storage, with the current key, prefixed by that key's id.

csharp
EncryptConnectionString(string connectionString)

Parameters ​

  • connectionString (string) - The plain text connection string.

Returns ​

The encrypted connection string, as .

DecryptConnectionString ​

Decrypts an encrypted connection string for internal use, with the key whose id it carries: the current key or one of the previous ones. One stored without a key id is tried with each.

csharp
DecryptConnectionString(string encryptedConnectionString)

Parameters ​

  • encryptedConnectionString (string) - The encrypted connection string.

Returns ​

The decrypted plain text connection string.

GetType ​

csharp
GetType()

ToString ​

csharp
ToString()

Equals ​

csharp
Equals()

GetHashCode ​

csharp
GetHashCode()