coreex-contract

Creates and modifies hand-authored CoreEx contract classes with source-generated members and reference-data wiring.

28|8|Updated Feb 21, 2022
One-click install
npx skills add https://github.com/Avanade/CoreEx --skill coreex-contract-avanade
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: coreex-contract
Source: https://github.com/Avanade/CoreEx/tree/main/.github/skills/coreex-contract
Command: npx skills add https://github.com/Avanade/CoreEx --skill coreex-contract-avanade

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Writing CoreEx contract (DTO/entity) classes by hand requires remembering many framework conventions: [Contract] and partial modifiers, interface selection (IIdentifier, IETag, IChangeLog), [ReadOnly] placement, reference-data property wiring, and Roslyn source-generation rules. This Skill guides an AI through those decisions so contracts are emitted correctly the first time. ## Core Features & Use Cases - New root contracts: Generates root entity contracts with identity, ETag concurrency, and change-log audit interfaces following CoreEx conventions. - Subordinate and request contracts: Produces nested-resource and request/response DTOs, including correct reference-data property patterns even on thin request types. - Contract modification: Adds properties, wires [ReferenceData<T>] navigation properties, adds interfaces, and extracts shared base classes when contracts repeat fields. - Use Case: Ask for a new Product contract with SKU, price, and a category reference-data field, and receive a complete [Contract] partial class with correct attributes, XML docs, and a CategoryCode ref-data property ready for the Roslyn generator. ## Quick Start Ask the AI to create a new root contract named Product in the Contracts project with a Sku, Price, and a Category reference-data property.

Frequently Asked Questions about coreex-contract

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a new CoreEx contract class?▼

Define the class with [Contract] and partial modifiers, implement IIdentifier<string?> and IETag for root entities, and add [ReadOnly(true)] on server-assigned fields like Id and ETag. The Roslyn source generator emits serialization, cloning, and equality members at build time.

How do I add a reference-data property to a CoreEx contract?▼

Confirm the type exists in ref-data.yaml, ensure the class is [Contract] and partial, then add [ReferenceData<T>] on a partial string? property named {Name}Code. After rebuilding, the generator emits the typed navigation property automatically.

When should a CoreEx contract implement IETag or IChangeLog?▼

Root contracts implement IETag by default for optimistic concurrency, omitted only on explicit request. IChangeLog is added when a created/updated audit trail is required; subordinate contracts rarely need it.

Why does a partial property cause CS9248 in a CoreEx contract?▼

Only [ReferenceData<T>]-decorated code properties may be partial, because the source generator supplies their implementation. Marking a plain property partial fails with CS9248 since no implementation part exists.

When should I not use this contract workflow?▼

Do not use it for reference-data contracts, which are generated by *.CodeGen from ref-data.yaml, or for infrastructure persistence models generated by *.Database CodeGen from dbex.yaml. DDD domain aggregates follow separate domain guidance.