wabbajack/Wabbajack.Server/DataLayer/SqlService.cs

30 lines
815 B
C#
Raw Normal View History

using System.Data.SqlClient;
using System.Threading.Tasks;
using Wabbajack.BuildServer;
2021-09-27 12:42:46 +00:00
using Wabbajack.Downloaders;
using Wabbajack.DTOs.JsonConverters;
2021-10-23 16:51:17 +00:00
namespace Wabbajack.Server.DataLayer;
public partial class SqlService
{
2021-10-23 16:51:17 +00:00
private readonly DownloadDispatcher _dispatcher;
private readonly DTOSerializer _dtos;
private readonly AppSettings _settings;
2021-10-23 16:51:17 +00:00
public SqlService(AppSettings settings, DTOSerializer dtos, DownloadDispatcher dispatcher)
{
_settings = settings;
_dtos = dtos;
_dispatcher = dispatcher;
// Ugly hack, but the SQL mappers need it
_dtoStatic = dtos;
}
2021-10-23 16:51:17 +00:00
public async Task<SqlConnection> Open()
{
var conn = new SqlConnection(_settings.SqlConnection);
await conn.OpenAsync();
return conn;
}
2021-10-23 16:51:17 +00:00
}