Files
tiku-backend.net/Tiku.Infrastructure/Persistence/Configurations/ContentV2ConfigurationSupport.cs
xiong 3f5957d744
Some checks failed
ci / release-gate (push) Has been cancelled
feat(content): establish v2 learning delivery foundation
2026-08-06 09:52:18 +08:00

22 lines
725 B
C#

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<TEntity>(
this EntityTypeBuilder<TEntity> builder,
string tableName)
where TEntity : Entity, ITenantOwned
{
builder.ConfigureEntity(tableName);
builder.HasAlternateKey(nameof(ITenantOwned.TenantId), nameof(Entity.Id));
builder.HasOne<Tenant>().WithMany()
.HasForeignKey(nameof(ITenantOwned.TenantId))
.OnDelete(DeleteBehavior.Cascade);
}
}