source: src/FinkiChattery/FinkiChattery.Persistence/Configurations/QuestionCategoryConfig.cs@ b25b9ea

dev
Last change on this file since b25b9ea was b25b9ea, checked in by Стојков Марко <mst@…>, 3 years ago

Get question state endpoint

  • Property mode set to 100644
File size: 1.2 KB
Line 
1using Microsoft.EntityFrameworkCore;
2using Microsoft.EntityFrameworkCore.Metadata.Builders;
3using System;
4using System.Collections.Generic;
5using System.Linq;
6using System.Text;
7using System.Threading.Tasks;
8using FinkiChattery.Persistence.Models;
9
10namespace FinkiChattery.Persistence.Configurations
11{
12 public class QuestionCategoryConfig : BaseConfig<QuestionCategory>
13 {
14 public QuestionCategoryConfig(string schema) : base(schema)
15 {
16 }
17
18 public override void Configure(EntityTypeBuilder<QuestionCategory> builder)
19 {
20 base.Configure(builder);
21
22 builder.ToTable("QuestionCategory", Schema);
23
24 builder.Property(x => x.QuestionFk).HasColumnName(@"QuestionFk").HasColumnType("bigint").IsRequired();
25 builder.Property(x => x.CategoryFk).HasColumnName(@"CategoryFk").HasColumnType("bigint").IsRequired();
26
27 builder.HasOne(x => x.Question).WithMany(x => x.QuestionCategories).HasForeignKey(x => x.QuestionFk).OnDelete(DeleteBehavior.Restrict);
28 builder.HasOne(x => x.Category).WithMany().HasForeignKey(x => x.CategoryFk).OnDelete(DeleteBehavior.Restrict);
29 }
30 }
31}
Note: See TracBrowser for help on using the repository browser.