원클릭으로
entity-configuration
Canonical EF Core Fluent API entity configuration rules. Load when creating or modifying IEntityTypeConfiguration classes.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Canonical EF Core Fluent API entity configuration rules. Load when creating or modifying IEntityTypeConfiguration classes.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Structure and rules for .NET projects using Clean Architecture with DDD. Use when the project has complex business domain, multiple use cases, need to test business logic in isolation, or when the system is enterprise, e-commerce, ERP, CRM, or any rich domain. Do not use for simple CRUDs without logic — prefer Vertical Slice in that case. For implementation details, load the required `backend/dotnet/orms/ef-core/*/SKILL.md` leaf skill(s) or your chosen data access skill.
Structure and rules for .NET projects using Hexagonal Architecture (Ports & Adapters). Use when the project has multiple input channels (API, CLI, message queue), need to test the domain in isolation, or when adapters change frequently. Do not use for simple CRUDs without logic — prefer Vertical Slice in that case. For implementation details, load the required `backend/dotnet/orms/ef-core/*/SKILL.md` leaf skill(s) or your chosen data access skill.
Structure and rules for .NET projects using Onion Architecture. Use when the project has a strong domain-centric focus with DDD, aggregate roots, and the Specification pattern. All dependencies point inward toward the domain core. Do not use for simple CRUDs without logic — prefer Vertical Slice in that case. For implementation details, load the required `backend/dotnet/orms/ef-core/*/SKILL.md` leaf skill(s) or your chosen data access skill.
Canonical DbContext setup and registration rules for EF Core. Load when creating or modifying DbContext classes or their DI wiring.
Pure LINQ standards for .NET 10 projects. Covers language operators, query composition, projection patterns, filtering, grouping, and performance best practices over IEnumerable<T> and IQueryable<T>. Load when writing or reviewing LINQ expressions in any layer. DO NOT load expecting EF Core-specific methods (ToListAsync, AsNoTracking, Include, ExecuteUpdateAsync) — those belong to `backend/dotnet/orms/ef-core/query-best-practices/SKILL.md`.
Canonical rules for using AppDbContext DIRECTLY from application code (use cases / handlers) when the project's data-access pattern is Direct DbContext — no repositories, no UnitOfWork. Load when the chosen pattern is Direct DbContext and a use case reads or writes data. This is the counterpart to repository-usage; never load both for the same task.
| name | entity-configuration |
| description | Canonical EF Core Fluent API entity configuration rules. Load when creating or modifying IEntityTypeConfiguration classes. |
| requires | ["backend-dotnet-csharp","dotnet-ddd"] |
| produces | ["entity-configurations","relationship-mappings"] |
nvarchar(max) or varchar(max) — always use explicit lengths from Entity.Rulesbuilder.ToTable() unless a future skill explicitly requires itHasDefaultValueSql() or ValueGeneratedOnAdd() for primary keysOwnsOne in this taxonomyIEntityTypeConfiguration<T> classesDbContextpublic sealed class ProductConfiguration : IEntityTypeConfiguration<Product>
{
public void Configure(EntityTypeBuilder<Product> builder)
{
builder.HasKey(product => product.Id);
builder.Property(product => product.Name)
.HasMaxLength(Product.Rules.NAME_MAX_LENGTH)
.HasColumnType("varchar");
builder.Property(product => product.Description)
.HasMaxLength(Product.Rules.DESCRIPTION_MAX_LENGTH)
.HasColumnType("nvarchar");
builder.Property(product => product.Price)
.HasColumnType("decimal(18,2)");
builder.Property(product => product.Status)
.HasConversion<string>()
.HasMaxLength(20)
.HasColumnType("varchar");
builder.Property(product => product.CreatedAt)
.HasColumnType("datetime2");
builder.Property(product => product.UpdatedAt)
.HasColumnType("datetime2");
builder.HasIndex(product => product.Name)
.IsUnique();
}
}
public sealed class OrderConfiguration : IEntityTypeConfiguration<Order>
{
public void Configure(EntityTypeBuilder<Order> builder)
{
builder.HasKey(order => order.Id);
builder.Property(order => order.CustomerId)
.HasColumnType("uniqueidentifier");
builder.Property(order => order.Status)
.HasConversion<string>()
.HasMaxLength(20)
.HasColumnType("varchar");
builder.HasMany(order => order.Items)
.WithOne()
.HasForeignKey(item => item.OrderId)
.OnDelete(DeleteBehavior.Cascade);
}
}
| CLR Type | SQL Type | Notes |
|---|---|---|
string ASCII | varchar(n) | Codes, names, identifiers |
string Unicode | nvarchar(n) | Descriptions and free text |
decimal | decimal(18,2) | Monetary values |
DateTime | datetime2 | Always UTC |
Guid | uniqueidentifier | PKs and FKs |
int | int | Counts and quantities |
bool | bit | Flags |
enum | varchar(n) | Use .HasConversion<string>() |
// ❌ NEVER use DataAnnotations
public class Product
{
[Key]
[Required]
[MaxLength(100)]
public Guid Id { get; set; }
}
// ❌ NEVER use nvarchar(max)
builder.Property(product => product.Description)
.HasColumnType("nvarchar(max)");
// ❌ NEVER use ToTable here
builder.ToTable("Products");
// ❌ NEVER use default SQL generation for PKs here
builder.Property(product => product.Id)
.HasDefaultValueSql("NEWID()");