-
-
Notifications
You must be signed in to change notification settings - Fork 244
Expand file tree
/
Copy pathCopiesConfiguration.cs
More file actions
46 lines (40 loc) · 1.43 KB
/
CopiesConfiguration.cs
File metadata and controls
46 lines (40 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
using CodeFirst.DataAccess.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace CodeFirst.DataAccess.Configurations;
public class CopiesConfiguration : IEntityTypeConfiguration<Copies>
{
public void Configure(EntityTypeBuilder<Copies> builder)
{
builder.HasKey(e => e.CopyId)
.HasName("copies_pkey");
builder.Property(e => e.MovieId)
.IsRequired()
.HasColumnName("movie_id");
builder.Property(e => e.CopyId)
.HasColumnName("copy_id");
builder.Property(e => e.Available)
.HasColumnName("available");
builder.ToTable("copies");
builder.HasData(new Copies(1, 1, true),
new Copies(2, 1, false),
new Copies(3, 2, true),
new Copies(4, 3, true),
new Copies(5, 3, false),
new Copies(6, 3, true),
new Copies(7, 4, true),
new Copies(8, 5, false),
new Copies(9, 6, true),
new Copies(10, 6, false),
new Copies(11, 6, true),
new Copies(12, 7, true),
new Copies(13, 7, true),
new Copies(14, 8, false),
new Copies(15, 9, true),
new Copies(16, 10, true),
new Copies(17, 10, false),
new Copies(18, 10, true),
new Copies(19, 10, true),
new Copies(20, 10, true));
}
}