Rebadge the rest of the files

This commit is contained in:
lumijiez
2025-06-03 18:24:40 +03:00
parent 1b6f69fcf9
commit 6a675ac111
77 changed files with 5931 additions and 0 deletions

View File

@@ -0,0 +1,40 @@
using Imprink.Domain.Entities;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Imprink.Infrastructure.Configuration;
public class EntityBaseConfiguration<T> : IEntityTypeConfiguration<T> where T : EntityBase
{
public virtual void Configure(EntityTypeBuilder<T> builder)
{
builder.HasKey(e => e.Id);
builder.Property(e => e.Id)
.HasDefaultValueSql("NEWID()");
builder.Property(e => e.CreatedAt)
.IsRequired();
builder.Property(e => e.ModifiedAt)
.IsRequired()
.HasDefaultValueSql("GETUTCDATE()");
builder.Property(e => e.CreatedBy)
.IsRequired()
.HasMaxLength(450);
builder.Property(e => e.ModifiedBy)
.IsRequired()
.HasMaxLength(450);
builder.HasIndex(e => e.CreatedAt)
.HasDatabaseName($"IX_{typeof(T).Name}_CreatedAt");
builder.HasIndex(e => e.ModifiedAt)
.HasDatabaseName($"IX_{typeof(T).Name}_ModifiedAt");
builder.HasIndex(e => e.CreatedBy)
.HasDatabaseName($"IX_{typeof(T).Name}_CreatedBy");
}
}