92 lines
3.1 KiB
C#
92 lines
3.1 KiB
C#
using Indotalent.Data.Entities;
|
|
using Indotalent.Shared.Consts;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
|
|
namespace Indotalent.Infrastructure.Database.MsSQL.Configuration;
|
|
|
|
public class VendorConfiguration : IEntityTypeConfiguration<Vendor>
|
|
{
|
|
public void Configure(EntityTypeBuilder<Vendor> builder)
|
|
{
|
|
builder.Property(e => e.Name)
|
|
.HasMaxLength(GlobalConsts.StringLengthShort);
|
|
|
|
builder.Property(e => e.AutoNumber)
|
|
.HasMaxLength(GlobalConsts.StringLengthShort);
|
|
|
|
builder.Property(e => e.Description)
|
|
.HasMaxLength(GlobalConsts.StringLengthMedium);
|
|
|
|
builder.Property(e => e.Street)
|
|
.HasMaxLength(GlobalConsts.StringLengthMedium);
|
|
|
|
builder.Property(e => e.City)
|
|
.HasMaxLength(GlobalConsts.StringLengthShort);
|
|
|
|
builder.Property(e => e.State)
|
|
.HasMaxLength(GlobalConsts.StringLengthShort);
|
|
|
|
builder.Property(e => e.ZipCode)
|
|
.HasMaxLength(GlobalConsts.StringLengthShort);
|
|
|
|
builder.Property(e => e.Country)
|
|
.HasMaxLength(GlobalConsts.StringLengthShort);
|
|
|
|
builder.Property(e => e.PhoneNumber)
|
|
.HasMaxLength(GlobalConsts.StringLengthShort);
|
|
|
|
builder.Property(e => e.FaxNumber)
|
|
.HasMaxLength(GlobalConsts.StringLengthShort);
|
|
|
|
builder.Property(e => e.EmailAddress)
|
|
.HasMaxLength(GlobalConsts.StringLengthShort);
|
|
|
|
builder.Property(e => e.Website)
|
|
.HasMaxLength(GlobalConsts.StringLengthShort);
|
|
|
|
builder.Property(e => e.WhatsApp)
|
|
.HasMaxLength(GlobalConsts.StringLengthShort);
|
|
|
|
builder.Property(e => e.LinkedIn)
|
|
.HasMaxLength(GlobalConsts.StringLengthShort);
|
|
|
|
builder.Property(e => e.Facebook)
|
|
.HasMaxLength(GlobalConsts.StringLengthShort);
|
|
|
|
builder.Property(e => e.Instagram)
|
|
.HasMaxLength(GlobalConsts.StringLengthShort);
|
|
|
|
builder.Property(e => e.TwitterX)
|
|
.HasMaxLength(GlobalConsts.StringLengthShort);
|
|
|
|
builder.Property(e => e.TikTok)
|
|
.HasMaxLength(GlobalConsts.StringLengthShort);
|
|
|
|
builder.Property(e => e.VendorGroupId)
|
|
.HasMaxLength(GlobalConsts.StringLengthId);
|
|
|
|
builder.Property(e => e.VendorCategoryId)
|
|
.HasMaxLength(GlobalConsts.StringLengthId);
|
|
|
|
builder.HasOne(e => e.VendorGroup)
|
|
.WithMany()
|
|
.HasForeignKey(e => e.VendorGroupId)
|
|
.OnDelete(DeleteBehavior.NoAction);
|
|
|
|
builder.HasOne(e => e.VendorCategory)
|
|
.WithMany()
|
|
.HasForeignKey(e => e.VendorCategoryId)
|
|
.OnDelete(DeleteBehavior.NoAction);
|
|
|
|
builder.HasMany(e => e.VendorContactList)
|
|
.WithOne(e => e.Vendor)
|
|
.HasForeignKey(e => e.VendorId)
|
|
.OnDelete(DeleteBehavior.Cascade);
|
|
|
|
builder.HasIndex(e => e.Name);
|
|
builder.HasIndex(e => e.AutoNumber).IsUnique();
|
|
builder.HasIndex(e => e.VendorGroupId);
|
|
builder.HasIndex(e => e.VendorCategoryId);
|
|
}
|
|
} |