[reputation] Move reputation to separate module.

This commit is contained in:
West14
2022-02-14 00:18:53 +02:00
parent 6f02031e65
commit a4a44198c5
20 changed files with 595 additions and 228 deletions
@@ -0,0 +1,21 @@
#nullable enable
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;
namespace West.TelegramBot.Reputation.Data;
public class ReputationContextFactory : IDesignTimeDbContextFactory<ReputationContext>
{
public ReputationContext CreateDbContext(string[] args)
{
var optionsBuilder = new DbContextOptionsBuilder<ReputationContext>();
if (args.Length != 1)
{
throw new InvalidDataException("You should pass DSN as CLI argument in order to use this.");
}
var dsn = args[0];
optionsBuilder.UseMySql(dsn, ServerVersion.AutoDetect(dsn));
return new ReputationContext(optionsBuilder.Options);
}
}