dev
Line | |
---|
1 | using Microsoft.EntityFrameworkCore;
|
---|
2 | using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
---|
3 | using System;
|
---|
4 | using System.Collections.Generic;
|
---|
5 | using System.Linq;
|
---|
6 | using System.Text;
|
---|
7 | using System.Threading.Tasks;
|
---|
8 | using FinkiChattery.Persistence.Models;
|
---|
9 |
|
---|
10 | namespace FinkiChattery.Persistence.Configurations
|
---|
11 | {
|
---|
12 | public class UpvoteConfig : BaseConfig<Upvote>
|
---|
13 | {
|
---|
14 | public UpvoteConfig(string schema) : base(schema)
|
---|
15 | {
|
---|
16 | }
|
---|
17 |
|
---|
18 | public override void Configure(EntityTypeBuilder<Upvote> builder)
|
---|
19 | {
|
---|
20 | base.Configure(builder);
|
---|
21 |
|
---|
22 | builder.ToTable("Upvote", Schema);
|
---|
23 |
|
---|
24 | builder.Property(x => x.StudentFk).HasColumnName(@"StudentFk").HasColumnType("bigint").IsRequired();
|
---|
25 | builder.Property(x => x.AnswerFk).HasColumnName(@"AnswerFk").HasColumnType("bigint").IsRequired();
|
---|
26 |
|
---|
27 | builder.HasOne(x => x.Student).WithMany().HasForeignKey(x => x.StudentFk).OnDelete(DeleteBehavior.Restrict);
|
---|
28 | builder.HasOne(x => x.Answer).WithMany(x => x.Upvotes).HasForeignKey(x => x.AnswerFk).OnDelete(DeleteBehavior.Restrict);
|
---|
29 | }
|
---|
30 | }
|
---|
31 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.