30 lines
1011 B
C#
30 lines
1011 B
C#
using DCGEngine.Database;
|
|
using DCGEngine.Database.Configuration;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.Extensions.Logging;
|
|
using Microsoft.Extensions.Options;
|
|
using SVSim.Database.Models;
|
|
|
|
namespace SVSim.Database;
|
|
|
|
public class SVSimDbContext : DCGEDbContext
|
|
{
|
|
public SVSimDbContext(IOptions<DCGEDatabaseConfiguration> configuration, ILogger<DCGEDbContext> logger, DbContextOptions options) : base(configuration, logger, options)
|
|
{
|
|
}
|
|
|
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
|
{
|
|
base.OnModelCreating(modelBuilder);
|
|
|
|
// For whatever reason it cannot figure out this relationship on it's own
|
|
modelBuilder.Entity<SleeveEntry>()
|
|
.HasMany<Viewer>(se => se.Viewers)
|
|
.WithMany(v => v.Sleeves);
|
|
|
|
modelBuilder.HasSequence<long>("ShortUdidSequence").StartsAt(400000000);
|
|
modelBuilder.Entity<Viewer>()
|
|
.Property(v => v.ShortUdid)
|
|
.UseSequence("ShortUdidSequence");
|
|
}
|
|
} |