/
afanasevn
/
MaxSystems
Обзор
Документация
Войти
/
afanasevn
/
MaxSystems
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
src/MaxSystems.Infrastructure/Data/Configurations/WorkConfiguration.cs
43 строки
2 KB
IBS\NAfanasev
Add project files.
18 июн 2026, 01:12
18 июн 2026, 01:12
b06aa39
Код
Авторство
О чём код?
using MaxSystems.Domain.Entities; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; namespace MaxSystems.Infrastructure.Data.Configurations; public class WorkConfiguration : IEntityTypeConfiguration<Work> { public void Configure(EntityTypeBuilder<Work> builder) { builder.ToTable("works"); builder.HasKey(x => x.Id); builder.Property(x => x.Number).HasMaxLength(32).IsRequired(); builder.HasIndex(x => x.Number).IsUnique(); builder.Property(x => x.Type).HasConversion<string>().HasMaxLength(32).IsRequired(); builder.Property(x => x.System).HasConversion<string>().HasMaxLength(32).IsRequired(); builder.Property(x => x.Priority).HasConversion<string>().HasMaxLength(16).IsRequired(); builder.Property(x => x.Status).HasConversion<string>().HasMaxLength(32).IsRequired(); builder.Property(x => x.Category).HasMaxLength(256).IsRequired(); builder.Property(x => x.Title).HasMaxLength(512).IsRequired(); builder.HasIndex(x => new { x.Status, x.PlannedDate }); builder.HasIndex(x => x.Type); builder.HasOne(x => x.Equipment) .WithMany(x => x.Works) .HasForeignKey(x => x.EquipmentId) .OnDelete(DeleteBehavior.SetNull); builder.HasOne(x => x.LeadSpecialist) .WithMany(x => x.LeadWorks) .HasForeignKey(x => x.LeadSpecialistId) .OnDelete(DeleteBehavior.SetNull); builder.HasOne(x => x.Assignee) .WithMany(x => x.AssignedWorks) .HasForeignKey(x => x.AssigneeId) .OnDelete(DeleteBehavior.SetNull); } }