mirror of
https://github.com/collinbarrett/FilterLists.git
synced 2026-03-11 09:04:27 +00:00
parent
ea81d615bf
commit
64298070ef
6 changed files with 66 additions and 1 deletions
|
|
@ -14,13 +14,16 @@ public FilterListsDbContext(DbContextOptions options)
|
|||
public DbSet<FilterList> FilterLists { get; set; }
|
||||
public DbSet<Maintainer> Maintainers { get; set; }
|
||||
public DbSet<Language> Languages { get; set; }
|
||||
public DbSet<Software> Software { get; set; }
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder.ApplyConfiguration(new FilterListTypeConfiguration());
|
||||
modelBuilder.ApplyConfiguration(new FilterListLanguageTypeConfiguration());
|
||||
modelBuilder.ApplyConfiguration(new FilterListSoftwareTypeConfiguration());
|
||||
modelBuilder.ApplyConfiguration(new MaintainerTypeConfiguration());
|
||||
modelBuilder.ApplyConfiguration(new LanguageTypeConfiguration());
|
||||
modelBuilder.ApplyConfiguration(new FilterListLanguageTypeConfiguration());
|
||||
modelBuilder.ApplyConfiguration(new SoftwareTypeConfiguration());
|
||||
base.OnModelCreating(modelBuilder);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ public class FilterList : BaseEntity
|
|||
public string HomeUrl { get; set; }
|
||||
public string IssuesUrl { get; set; }
|
||||
public ICollection<FilterListLanguage> FilterListLanguages { get; set; }
|
||||
public ICollection<FilterListSoftware> FilterListSoftware { get; set; }
|
||||
public int MaintainerId { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string ViewUrl { get; set; }
|
||||
|
|
|
|||
11
src/FilterLists.Data/Entities/FilterListSoftware.cs
Normal file
11
src/FilterLists.Data/Entities/FilterListSoftware.cs
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
namespace FilterLists.Data.Entities
|
||||
{
|
||||
public class FilterListSoftware : BaseEntity
|
||||
{
|
||||
public int FilterListId { get; set; }
|
||||
public FilterList FilterList { get; set; }
|
||||
|
||||
public int SoftwareId { get; set; }
|
||||
public Software Software { get; set; }
|
||||
}
|
||||
}
|
||||
12
src/FilterLists.Data/Entities/Software.cs
Normal file
12
src/FilterLists.Data/Entities/Software.cs
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace FilterLists.Data.Entities
|
||||
{
|
||||
public class Software : BaseEntity
|
||||
{
|
||||
public string DownloadUrl { get; set; }
|
||||
public string HomeUrl { get; set; }
|
||||
public ICollection<FilterListSoftware> FilterListSoftware { get; set; }
|
||||
public string Name { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
using FilterLists.Data.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace FilterLists.Data.EntityTypeConfigurations
|
||||
{
|
||||
public class FilterListSoftwareTypeConfiguration : BaseEntityTypeConfiguration<FilterListSoftware>
|
||||
{
|
||||
public override void Configure(EntityTypeBuilder<FilterListSoftware> entityTypeBuilder)
|
||||
{
|
||||
entityTypeBuilder.ToTable("filterlists_software");
|
||||
entityTypeBuilder.HasKey(x => new {x.FilterListId, x.SoftwareId});
|
||||
entityTypeBuilder.Ignore(x => x.Id);
|
||||
base.Configure(entityTypeBuilder);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
using FilterLists.Data.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace FilterLists.Data.EntityTypeConfigurations
|
||||
{
|
||||
public class SoftwareTypeConfiguration : BaseEntityTypeConfiguration<Software>
|
||||
{
|
||||
public override void Configure(EntityTypeBuilder<Software> entityTypeBuilder)
|
||||
{
|
||||
entityTypeBuilder.ToTable("software");
|
||||
entityTypeBuilder.Property(b => b.DownloadUrl)
|
||||
.HasMaxLength(2083);
|
||||
entityTypeBuilder.Property(b => b.HomeUrl)
|
||||
.HasMaxLength(2083);
|
||||
entityTypeBuilder.Property(b => b.Name)
|
||||
.HasMaxLength(126);
|
||||
base.Configure(entityTypeBuilder);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue