mirror of
https://github.com/collinbarrett/FilterLists.git
synced 2026-03-11 09:04:27 +00:00
refactor(dir): ♻ lint command entity type configs
This commit is contained in:
parent
0f561e1c49
commit
c97fcd0188
3 changed files with 13 additions and 6 deletions
|
|
@ -14,7 +14,6 @@ public virtual void Configure(EntityTypeBuilder<Change> builder)
|
|||
// TODO: register and resolve INameRewriter
|
||||
var nr = new SnakeCaseNameRewriter(CultureInfo.InvariantCulture);
|
||||
|
||||
builder.ToTable($"{nr.RewriteName(nameof(Change))}s");
|
||||
builder.Property<int>(nameof(Queries.Entities.Change.Id));
|
||||
|
||||
// TODO: TDiscriminator should really be AggregateType rather than string but needs name rewriting
|
||||
|
|
|
|||
|
|
@ -9,8 +9,11 @@ internal class FilterListTypeConfiguration : IEntityTypeConfiguration<FilterList
|
|||
public virtual void Configure(EntityTypeBuilder<FilterList> builder)
|
||||
{
|
||||
builder.Property<int>(nameof(Queries.Entities.FilterList.Id));
|
||||
builder.HasMany("_changes").WithOne();
|
||||
builder.Navigation("_changes").AutoInclude();
|
||||
builder.Navigation(f => f.ViewUrls).AutoInclude();
|
||||
builder.HasMany(f => f.Changes)
|
||||
.WithOne(c => c.Current);
|
||||
builder.Navigation(f => f.Changes)
|
||||
.AutoInclude();
|
||||
builder.Navigation(f => f.ViewUrls)
|
||||
.AutoInclude();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
using FilterLists.Directory.Domain.Aggregates.FilterLists;
|
||||
using System.Globalization;
|
||||
using EFCore.NamingConventions.Internal;
|
||||
using FilterLists.Directory.Domain.Aggregates.FilterLists;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
|
|
@ -8,7 +10,10 @@ internal class FilterListViewUrlTypeConfiguration : IEntityTypeConfiguration<Fil
|
|||
{
|
||||
public virtual void Configure(EntityTypeBuilder<FilterListViewUrl> builder)
|
||||
{
|
||||
builder.ToTable(nameof(FilterListViewUrl) + "s");
|
||||
// TODO: register and resolve INameRewriter
|
||||
var nr = new SnakeCaseNameRewriter(CultureInfo.InvariantCulture);
|
||||
|
||||
builder.ToTable($"{nr.RewriteName(nameof(Queries.Entities.FilterListViewUrl))}s");
|
||||
builder.Property<int>(nameof(Queries.Entities.FilterListViewUrl.Id));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue