Gallery verwendet Datenbank

- Menü: Fixed typo in Gallerie
- Datenbanken-Funktionen dokumentiert
This commit is contained in:
Simon Lübeß
2023-10-10 18:56:05 +02:00
parent 1b28481b5d
commit e6a2db0753
9 changed files with 94 additions and 63 deletions

View File

@ -5,6 +5,9 @@ using Dapper;
namespace DataAccess.DbAccess;
/// <summary>
/// Bietet lesenden und schreibenden Zugriff auf eine Datenbank.
/// </summary>
public class SqlDataAccess : ISqlDataAccess
{
private readonly IConfiguration _config;
@ -14,14 +17,14 @@ public class SqlDataAccess : ISqlDataAccess
_config = config;
}
public async Task<IEnumerable<T>> LoadData<T, U>(string storedProcedure, U parameters, string connectionId = "Default")
public async Task<IEnumerable<TResult>> LoadData<TResult, TParameter>(string storedProcedure, TParameter parameters, string connectionId = "Default")
{
using IDbConnection connection = new SqlConnection(_config.GetConnectionString(connectionId));
return await connection.QueryAsync<T>(storedProcedure, parameters, commandType: CommandType.StoredProcedure);
return await connection.QueryAsync<TResult>(storedProcedure, parameters, commandType: CommandType.StoredProcedure);
}
public async Task SaveData<T>(string storedProcedure, T parameters, string connectionId = "Default")
public async Task SaveData<TParameter>(string storedProcedure, TParameter parameters, string connectionId = "Default")
{
using IDbConnection connection = new SqlConnection(_config.GetConnectionString(connectionId));