بنقرة واحدة
ef-core-entity-implementation
Use this skill when implementing domain entities and their properties in .NET.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Use this skill when implementing domain entities and their properties in .NET.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Design system patterns for reusable UI via atomic design, Tailwind tokens/variants, and accessibility. Use when creating atoms/molecules, theming, or hardening a11y.
Entity Framework Core best practices for configuration, queries, concurrency, and multi-tenancy.
Frontend architecture patterns for React apps (React Router 7, TanStack Query). Use when planning features, defining routes, data strategies, and component gaps.
Infrastructure standards for Docker, scripts, middleware, and authentication in multi-tenant deployments.
Integration testing performance optimization, test parallelization, cleanup strategies, and CI/CD categorization patterns. Use when optimizing test execution speed, managing test data, or structuring tests for automated pipelines.
ASP.NET Core Minimal APIs patterns for endpoints, DTOs, validation, and service integration. Use when implementing API endpoints, defining request/response contracts, or structuring API projects with clean separation of concerns.
| name | ef-core-entity-implementation |
| description | Use this skill when implementing domain entities and their properties in .NET. |
namespace GloboTicket.Domain.Entities;
/// <summary>
/// [Clear, concise description of the entity's business purpose]
/// </summary>
public class EntityName : [Entity | MultiTenantEntity]
{
// Properties defined here
}
required keyword: public required string Name { get; set; }= string.Empty;public string? Description { get; set; }null (implicit)/// <summary>
/// The collection of related entities.
/// </summary>
public ICollection<RelatedEntity> RelatedEntities { get; set; } = new List<RelatedEntity>();
IMPORTANT: When creating a new relationship, ALWAYS add the collection navigation property to the parent (one) side:
Show with a relationship to Venue, add public ICollection<Show> Shows { get; set; } = new List<Show>(); to the Venue entityWithMany(parent => parent.Collection) pattern in the configuration on the many side/// <summary>
/// The parent entity.
/// </summary>
public ParentEntity? Parent { get; set; }
/// <summary>
/// Foreign key for the parent entity.
/// </summary>
public int? ParentId { get; set; }
/// <summary>
/// The parent entity.
/// </summary>
public ParentEntity Parent { get; private set; }
/// <summary>
/// Foreign key for the parent entity.
/// </summary>
public int ParentId { get; private set; }
Important Notes on Required Navigation Properties:
private set= null!;) in constructors to avoid compiler warnings/// <summary>
/// The billing address for this entity.
/// </summary>
public required Address BillingAddress { get; set; }
/// <summary>
/// Optional shipping address.
/// </summary>
public Address? ShippingAddress { get; set; }
using NetTopologySuite.Geometries;
/// <summary>
/// Geographic location (latitude/longitude).
/// </summary>
public Point? Location { get; set; }
When inheriting from MultiTenantEntity, DO NOT manually add:
TenantId property (inherited from base)Tenant navigation property (inherited from base)Id, CreatedAt, UpdatedAt (inherited through base chain)These are automatically provided by the inheritance hierarchy.
string.Empty for required, null for optionaldecimal for monetary values, pricesDateTime (UTC assumed), nullable for optional datesfalse with clear semantic meaningDomain.Enums namespaceGuid type, typically optional except for unique identifiersEntities that have required navigation properties (non-nullable relationships) must have:
public class Show : Entity
{
/// <summary>
/// Initializes a new instance of the <see cref="Show"/> class.
/// </summary>
/// <param name="act">The Act that is performing in this show.</param>
/// <param name="venue">The Venue where this show is held.</param>
/// <exception cref="ArgumentNullException">Thrown when act or venue is null.</exception>
public Show(Act act, Venue venue)
{
ArgumentNullException.ThrowIfNull(act);
ArgumentNullException.ThrowIfNull(venue);
Act = act;
ActId = act.Id;
Venue = venue;
VenueId = venue.Id;
}
/// <summary>
/// Private parameterless constructor for Entity Framework Core.
/// </summary>
private Show()
{
Act = null!;
Venue = null!;
}
/// <summary>
/// Gets or sets the start time of the show in UTC.
/// </summary>
public required DateTime StartTime { get; set; }
/// <summary>
/// Gets the foreign key for the Act performing in this show.
/// </summary>
public int ActId { get; private set; }
/// <summary>
/// Gets the Act that is performing in this show.
/// </summary>
public Act Act { get; private set; }
/// <summary>
/// Gets the foreign key for the Venue where this show is held.
/// </summary>
public int VenueId { get; private set; }
/// <summary>
/// Gets the Venue where this show is held.
/// </summary>
public Venue Venue { get; private set; }
}
required keyword insteadArgumentNullException.ThrowIfNull()null! to suppress compiler warningsprivate set to enforce initialization through constructor