public class ApplicationDbContext : IdentityDbContext<ApplicationUser, IdentityRole<Guid>, Guid>
{
public ApplicationDbContext()
{
}
public ApplicationDbContext(DbContextOptions options) : base(options) { }
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<IdentityUserLogin<Guid>>()
.HasNoKey();
modelBuilder.Entity<IdentityUserRole<Guid>>()
.HasNoKey();
modelBuilder.Entity<IdentityUserToken<Guid>>()
.HasNoKey();
modelBuilder.Entity<StakedBottle>(entity =>
{
entity.Property(e => e.Keywords)
.HasConversion(
v => string.Join(',', v),
v => v.Split(',', StringSplitOptions.RemoveEmptyEntries).Select(e => e.Trim()).ToArray()
);
});
modelBuilder.Entity<StakedBottle>()
.Property(e => e.Why)
.HasConversion(
v => JsonConvert.SerializeObject(v),
v => JsonConvert.DeserializeObject<List<BottleWhyDetails>>(v) ?? new List<BottleWhyDetails>()
);
modelBuilder.Entity<StripePayment>();
}
public virtual DbSet<UserStakedBottle> UserBottles { get; set; }
public virtual DbSet<StakedBottle> StakeBottles { get; set; }
public virtual DbSet<Distillery> Distilleries { get; set; }
public virtual DbSet<StripePayment> StripePayments { get; set; }
public virtual DbSet<StripePromoCode> StripePromoCodes { get; set; }
}