/
valzem
/
MatControl
Обзор
Документация
Войти
/
valzem
/
MatControl
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
src/MatControl.Data/Configurations/AssetMovementConfiguration.cs
34 строки
1 KB
MatControl Dev
Этап 0-1: каркас решения и база данных (сущности, миграции, seed)
07 авг 2026, 09:52
07 авг 2026, 09:52
cefd996
Код
Авторство
О чём код?
using MatControl.Domain; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; namespace MatControl.Data.Configurations; public class AssetMovementConfiguration : IEntityTypeConfiguration<AssetMovement> { public void Configure(EntityTypeBuilder<AssetMovement> builder) { builder.Property(m => m.QuantityTransferred).HasColumnType("decimal(18,2)"); builder.Property(m => m.MovementType).HasConversion<string>().HasMaxLength(50); builder.HasOne(m => m.Asset) .WithMany(a => a.Movements) .HasForeignKey(m => m.AssetId) .OnDelete(DeleteBehavior.SetNull); builder.HasOne(m => m.Supply) .WithMany(s => s.Movements) .HasForeignKey(m => m.SupplyId) .OnDelete(DeleteBehavior.SetNull); builder.HasOne(m => m.FromEmployee) .WithMany() .HasForeignKey(m => m.FromEmployeeId) .OnDelete(DeleteBehavior.Restrict); builder.HasOne(m => m.ToEmployee) .WithMany() .HasForeignKey(m => m.ToEmployeeId) .OnDelete(DeleteBehavior.Restrict); } }