/
gamma
/
Gamma-API
Обзор
Документация
Войти
/
gamma
/
Gamma-API
Код
Запросы
0
Пакеты
0
Релизы
0
CI/CD
Аналитика
master
Gamma.Data.Configurations/SiteConfiguration.cs
21 строка
787 B
Vlavimir Solodovnikov
Add Entities, repositories and services
11 июн 2022, 00:57
11 июн 2022, 00:57
c3562f4
Код
Авторство
О чём код?
using Gamma.Data.Entities; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; namespace Gamma.Data.Configurations { public class SiteConfiguration : IEntityTypeConfiguration<Site> { public void Configure(EntityTypeBuilder<Site> builder) { builder.HasKey(x => x.SiteId); builder.Property(x => x.Name).HasMaxLength(64); builder.Property(x => x.CreatedDate); builder.Property(x => x.UpdatedDate); builder.HasOne(x => x.Owner).WithMany().HasForeignKey("OwnerId").IsRequired().OnDelete(DeleteBehavior.NoAction); builder.HasOne(x => x.Domain).WithMany().HasForeignKey("DomainId").IsRequired(false).OnDelete(DeleteBehavior.SetNull); } } }