autobus-api_old/AutobusApi.Infrastructure/Data/Configurations/EntityBaseConfiguration.cs

28 lines
737 B
C#

using AutobusApi.Domain.Common;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace AutobusApi.Infrastructure.Data.Configurations;
public class EntityBaseConfiguration<TEntity> : IEntityTypeConfiguration<TEntity>
where TEntity : EntityBase
{
public virtual void Configure(EntityTypeBuilder<TEntity> builder)
{
builder
.HasKey(e => e.Id);
builder
.Property(e => e.Id)
.HasColumnName("id")
.HasColumnType("int")
.IsRequired();
builder
.Property(e => e.IsDeleted)
.HasColumnName("is_deleted")
.HasColumnType("boolean")
.IsRequired();
}
}