first commit
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
using MyNewProjectName.Domain.Entities;
|
||||
|
||||
namespace MyNewProjectName.Infrastructure.Persistence.Configurations;
|
||||
|
||||
/// <summary>
|
||||
/// Entity configuration for SampleEntity
|
||||
/// </summary>
|
||||
public class SampleEntityConfiguration : IEntityTypeConfiguration<SampleEntity>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<SampleEntity> builder)
|
||||
{
|
||||
builder.ToTable("Samples");
|
||||
|
||||
builder.HasKey(e => e.Id);
|
||||
|
||||
builder.Property(e => e.Name)
|
||||
.IsRequired()
|
||||
.HasMaxLength(200);
|
||||
|
||||
builder.Property(e => e.Description)
|
||||
.HasMaxLength(1000);
|
||||
|
||||
builder.Property(e => e.CreatedBy)
|
||||
.HasMaxLength(100);
|
||||
|
||||
builder.Property(e => e.UpdatedBy)
|
||||
.HasMaxLength(100);
|
||||
|
||||
// Index for common queries
|
||||
builder.HasIndex(e => e.Name);
|
||||
builder.HasIndex(e => e.IsActive);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user