PlayerManagement/Database/Configurations/MarshalGuardConfiguration.cs
Tomasi - Developing 35e83c4735 beta 0.0.3
2024-11-26 08:43:01 +01:00

27 lines
1.3 KiB
C#

using Database.Entities;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Database.Configurations;
public class MarshalGuardConfiguration : IEntityTypeConfiguration<MarshalGuard>
{
public void Configure(EntityTypeBuilder<MarshalGuard> builder)
{
builder.HasKey(marshalGuard => marshalGuard.Id);
builder.Property(marshalGuard => marshalGuard.Id).ValueGeneratedNever();
builder.Property(marshalGuard => marshalGuard.EventDate).IsRequired();
builder.Property(marshalGuard => marshalGuard.Level).IsRequired();
builder.Property(marshalGuard => marshalGuard.RewardPhase).IsRequired();
builder.Property(marshalGuard => marshalGuard.AllianceSize).IsRequired();
builder.Property(marshalGuard => marshalGuard.CreatedBy).IsRequired().HasMaxLength(150);
builder.Property(marshalGuard => marshalGuard.ModifiedOn).IsRequired(false);
builder.Property(marshalGuard => marshalGuard.ModifiedBy).IsRequired(false).HasMaxLength(150);
builder.HasOne(marshalGuard => marshalGuard.Alliance)
.WithMany(alliance => alliance.MarshalGuards)
.HasForeignKey(marshalGuard => marshalGuard.AllianceId)
.OnDelete(DeleteBehavior.Cascade);
}
}