feat(trades): dynamic settings, IFinlyticLogger, live log streaming, and EF migration
This commit is contained in:
@@ -1,10 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using FinlyticCore.Database;
|
||||
using FinlyticCore.Entities.Settings;
|
||||
using FinlyticTrades.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Design;
|
||||
|
||||
namespace FinlyticTrades.Database;
|
||||
|
||||
public class TradesDbContext : DbContext
|
||||
public class TradesDbContext : DbContext, ISettingsDbContext
|
||||
{
|
||||
public TradesDbContext(DbContextOptions<TradesDbContext> options) : base(options) { }
|
||||
|
||||
@@ -20,7 +25,7 @@ public class TradesDbContext : DbContext
|
||||
modelBuilder.Entity<SettingEntity>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Id);
|
||||
entity.HasIndex(e => e.Key);
|
||||
entity.HasIndex(e => e.Key).IsUnique();
|
||||
});
|
||||
|
||||
var stringListConverter =
|
||||
@@ -57,3 +62,13 @@ public class TradesDbContext : DbContext
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public class TradesDbContextFactory : IDesignTimeDbContextFactory<TradesDbContext>
|
||||
{
|
||||
public TradesDbContext CreateDbContext(string[] args)
|
||||
{
|
||||
var optionsBuilder = new DbContextOptionsBuilder<TradesDbContext>();
|
||||
optionsBuilder.UseNpgsql("Host=localhost;Database=trades;Username=postgres;Password=postgres");
|
||||
return new TradesDbContext(optionsBuilder.Options);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user