using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; using Tiku.Domain.Common; using Tiku.Domain.Tenancy; namespace Tiku.Infrastructure.Persistence.Configurations; internal static class ContentV2ConfigurationSupport { internal static void ConfigureTenantOwned( this EntityTypeBuilder builder, string tableName) where TEntity : Entity, ITenantOwned { builder.ConfigureEntity(tableName); builder.HasAlternateKey(nameof(ITenantOwned.TenantId), nameof(Entity.Id)); builder.HasOne().WithMany() .HasForeignKey(nameof(ITenantOwned.TenantId)) .OnDelete(DeleteBehavior.Cascade); } }