using Domain;
using Infrastructure.Identity;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Infrastructure.EntityTypes
{
public class LinkEntityType : IEntityTypeConfiguration
{
public void Configure(EntityTypeBuilder builder)
{
builder.HasKey(o => o.Id);
builder.Property(o => o.Url).HasMaxLength(250).IsRequired();
builder.Property(o => o.CreatedAt).IsRequired();
builder.HasOne()
.WithMany()
.HasForeignKey(o => o.CreatedBy)
.IsRequired()
.OnDelete(DeleteBehavior.Cascade);
}
}
}