This repository has been archived on 2024-12-22. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
elliebot/src/EllieBot/Db/PostgreSqlContext.cs

26 lines
678 B
C#
Raw Normal View History

2024-05-14 23:08:36 +12:00
using Microsoft.EntityFrameworkCore;
namespace EllieBot.Db;
public sealed class PostgreSqlContext : EllieContext
{
private readonly string _connStr;
protected override string CurrencyTransactionOtherIdDefaultValue
2024-05-14 23:08:36 +12:00
=> "NULL";
public PostgreSqlContext(string connStr = "Host=localhost")
{
_connStr = connStr;
}
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);
2024-05-14 23:08:36 +12:00
base.OnConfiguring(optionsBuilder);
optionsBuilder
.UseLowerCaseNamingConvention()
.UseNpgsql(_connStr);
}
}