add mysql database provider (#1375)

* refactor sqlite into separate library

* support mysql

* fixes

* sql fixes

* cleanup

* update changelog
This commit is contained in:
Jason Dove
2023-08-12 21:44:14 -05:00
committed by GitHub
parent d951035183
commit a7661c8498
530 changed files with 18471 additions and 720 deletions
@@ -0,0 +1,29 @@
using System.Data;
using Dapper;
namespace ErsatzTV.Infrastructure.Sqlite.Data;
public abstract class SqliteTypeHandler<T> : SqlMapper.TypeHandler<T>
{
// Parameters are converted by Microsoft.Data.Sqlite
public override void SetValue(IDbDataParameter parameter, T value)
=> parameter.Value = value;
}
public class DateTimeOffsetHandler : SqliteTypeHandler<DateTimeOffset>
{
public override DateTimeOffset Parse(object value)
=> DateTimeOffset.Parse((string)value);
}
public class GuidHandler : SqliteTypeHandler<Guid>
{
public override Guid Parse(object value)
=> Guid.Parse((string)value);
}
public class TimeSpanHandler : SqliteTypeHandler<TimeSpan>
{
public override TimeSpan Parse(object value)
=> TimeSpan.Parse((string)value);
}