fix(dr): 🐛 fk name

This commit is contained in:
Collin M. Barrett 2021-11-18 15:10:51 -06:00
parent 09214b914f
commit 891678f8d4
2 changed files with 6 additions and 2 deletions

View file

@ -1,6 +1,7 @@
using FilterLists.Directory.Domain.Aggregates.Changes;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Change = FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.Change;
namespace FilterLists.Directory.Infrastructure.Persistence.Commands.EntityTypeConfigurations;
@ -8,6 +9,11 @@ internal class FilterListChangeTypeConfiguration : IEntityTypeConfiguration<Filt
{
public virtual void Configure(EntityTypeBuilder<FilterListChange> builder)
{
builder.Property<int>(nameof(Change.FilterListId));
builder.HasOne(c => c.Current)
.WithMany(f => f.Changes)
.HasForeignKey(nameof(Change.FilterListId));
// TODO: share by configuring IChange<TAggregate>
// TODO: serialize/deserialize json via value converter
builder.Ignore(c => c.Before);

View file

@ -9,8 +9,6 @@ internal class FilterListTypeConfiguration : IEntityTypeConfiguration<FilterList
public virtual void Configure(EntityTypeBuilder<FilterList> builder)
{
builder.Property<int>(nameof(Queries.Entities.FilterList.Id));
builder.HasMany(f => f.Changes)
.WithOne(c => c.Current);
builder.Navigation(f => f.Changes)
.AutoInclude();
builder.Navigation(f => f.ViewUrls)