Move source code into "Source" folder
This commit is contained in:
parent
1ee73fa1a7
commit
389fbb2371
287 changed files with 26 additions and 8 deletions
25
Source/DataLayer/Configurations/SeriesBookConfig.cs
Normal file
25
Source/DataLayer/Configurations/SeriesBookConfig.cs
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace DataLayer.Configurations
|
||||
{
|
||||
internal class SeriesBookConfig : IEntityTypeConfiguration<SeriesBook>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<SeriesBook> entity)
|
||||
{
|
||||
entity.HasKey(sb => new { sb.SeriesId, sb.BookId });
|
||||
|
||||
entity.HasIndex(sb => sb.SeriesId);
|
||||
entity.HasIndex(sb => sb.BookId);
|
||||
|
||||
entity
|
||||
.HasOne(sb => sb.Series)
|
||||
.WithMany(s => s.BooksLink)
|
||||
.HasForeignKey(sb => sb.SeriesId);
|
||||
entity
|
||||
.HasOne(sb => sb.Book)
|
||||
.WithMany(b => b.SeriesLink)
|
||||
.HasForeignKey(sb => sb.BookId);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue