Files
Shogi/Shogi.Api/Repositories/QueryRepository.cs
Lucas Morgan 51d234d871 Replace custom socket implementation with SignalR.
Replace MSAL and custom cookie auth with Microsoft.Identity.EntityFramework
Also some UI redesign to accommodate different login experience.
2024-08-25 03:46:44 +00:00

25 lines
757 B
C#

using Dapper;
using Shogi.Api.Repositories.Dto;
using System.Data;
using System.Data.SqlClient;
namespace Shogi.Api.Repositories;
public class QueryRepository(IConfiguration configuration)
{
private readonly string connectionString = configuration.GetConnectionString("ShogiDatabase")
?? throw new InvalidOperationException("No database configured for QueryRepository.");
public async Task<IEnumerable<SessionDto>> ReadSessionsMetadata(string playerId)
{
using var connection = new SqlConnection(this.connectionString);
var results = await connection.QueryMultipleAsync(
"session.ReadSessionsMetadata",
new { PlayerId = playerId },
commandType: CommandType.StoredProcedure);
return await results.ReadAsync<SessionDto>();
}
}