Files
Backend-Api/AccountMangement.Infrastructure.EFCore/Mappings/CameraAccountMapping.cs
2024-07-05 21:36:15 +03:30

35 lines
1.2 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using AccountManagement.Domain.CameraAccountAgg;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace AccountMangement.Infrastructure.EFCore.Mappings;
public class CameraAccountMapping : IEntityTypeConfiguration<CameraAccount>
{
public void Configure(EntityTypeBuilder<CameraAccount> builder)
{
builder.ToTable("CameraAccounts");
builder.HasKey(x => x.id);
builder.Property(x => x.Username).HasMaxLength(100).IsRequired();
builder.Property(x => x.Password).HasMaxLength(1000).IsRequired();
builder.Property(x => x.Mobile).HasMaxLength(11).IsRequired(false);
builder.Property(x => x.Username).HasMaxLength(100).IsRequired();
builder.Property(x => x.WorkshopId);
builder.Property(x => x.WorkshopName).HasMaxLength(100).IsRequired(false);
builder.Property(x => x.AccountId);
builder.Property(x => x.IsActiveSting).HasMaxLength(5).IsRequired();
builder.HasOne(x => x.Account)
.WithMany(x => x.CameraAccounts)
.HasForeignKey(x => x.AccountId);
}
}