0
0

Add one to many relations

This commit is contained in:
Sergey Chebotar 2023-02-01 07:49:31 +03:00
parent a9e52b199b
commit 8faebbd63c
3 changed files with 6 additions and 1 deletions

View File

@ -11,7 +11,7 @@ using MyDarling.Models;
namespace MyDarling.Migrations namespace MyDarling.Migrations
{ {
[DbContext(typeof(DataContext))] [DbContext(typeof(DataContext))]
[Migration("20230131125316_Init")] [Migration("20230201044832_Init")]
partial class Init partial class Init
{ {
/// <inheritdoc /> /// <inheritdoc />

View File

@ -15,6 +15,11 @@ namespace MyDarling.Models
opts.UseSqlite(configuration.GetConnectionString("MyDarlingDb")); opts.UseSqlite(configuration.GetConnectionString("MyDarlingDb"));
} }
protected override void OnModelCreating(ModelBuilder builder)
{
builder.Entity<UnderwearBundle>().HasMany(b => b.Figures).WithOne();
}
public DbSet<UnderwearBundle> UnderwearBundles => Set<UnderwearBundle>(); public DbSet<UnderwearBundle> UnderwearBundles => Set<UnderwearBundle>();
public DbSet<Figure> Figures => Set<Figure>(); public DbSet<Figure> Figures => Set<Figure>();
} }