26 lines
715 B
C#
26 lines
715 B
C#
using Koogle.Domain.Entities;
|
||
using Microsoft.EntityFrameworkCore;
|
||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||
|
||
namespace Koogle.Infrastructure.Data.Configurations;
|
||
|
||
public class ClubConfiguration : IEntityTypeConfiguration<Club>
|
||
{
|
||
public void Configure(EntityTypeBuilder<Club> builder)
|
||
{
|
||
builder.ToTable("Clubs");
|
||
|
||
builder.HasKey(x => x.Id);
|
||
|
||
builder.Property(x => x.Name)
|
||
.HasMaxLength(200)
|
||
.IsRequired();
|
||
|
||
// Enum als int (Default) – explizit ist oft schöner
|
||
builder.Property(x => x.ExpenseCalculation)
|
||
.HasConversion<int>()
|
||
.IsRequired();
|
||
|
||
builder.HasQueryFilter(x => !x.IsDeleted);
|
||
}
|
||
} |