skills/aurelius-objects/SKILL.md
Save, load, update, delete, merge, and navigate entity objects using TMS Aurelius ORM (TObjectManager). Use when the user asks how to persist or retrieve data with Aurelius, manage object lifetime, work with associations or collections at runtime, handle transactions, use cached updates, or control concurrency. Does NOT cover query DSL or criteria/projections (those are in a separate skill). Triggers on requests like "save an entity with Aurelius", "load a customer from the database", "add items to a collection", "how do I update an object", "flush changes", "delete a record with Aurelius", "merge a transient object", "how do transactions work in Aurelius", "batch updates Aurelius".
npx skillsauth add tmssoftware/skills aurelius-objectsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Always work through a TObjectManager instance. All persistence methods (Save, Flush, Remove, etc.) are called on the manager, never written as raw SQL.
Loading a known id: use Manager.Find<T>(Id) — returns the cached instance if already loaded, otherwise hits the database.
Loading multiple objects with criteria: use Manager.Find<T> (no argument) to get a fluent query builder, then call .List.
Saving a new object: call Manager.Save(obj) — the manager takes ownership and tracks changes from that point. Save executes the INSERT immediately. Do not call Flush after Save for a new object; that is only for persisting changes to already-managed objects.
Updating a managed object: just change its properties and call Manager.Flush (or Manager.Flush(obj) for a single object). No explicit "update" call needed.
Updating a transient object (from outside the manager): call Manager.Update(obj) — but be aware this writes all properties on flush, not just the changed ones.
Conflicting identity: if an object with the same id is already cached, use Manager.Merge<T>(transient) instead of Update — it copies data into the existing managed instance.
Deleting: call Manager.Remove(obj) — the object must be managed (loaded through this manager or registered via Save/Update).
TList<T>), free the list but not the items inside it — the items remain managed.ListValues) return lists with OwnsObjects = True; destroying the list also destroys the items.Manager.OwnsObjects := False before calling Free.Manager.AddOwnership(obj) before Save if you want the manager to own the object even when Save raises an exception.Manager.Flush(singleObject) over Manager.Flush (no args). The no-arg form iterates the entire manager cache and can be slow when many objects are loaded.Invoice.CustomerId field bypasses the ORM and causes inconsistencies.// WRONG — bypasses the ORM:
Invoice.CustomerId := 42;
// CORRECT — assign the managed object:
Invoice.Customer := Manager.Find<TCustomer>(42);
CascadeTypeAll (no orphan removal): removing an item from the collection sets its foreign key to NULL — the row stays in the database as an orphan.CascadeTypeAllRemoveOrphan: removing an item from the collection deletes the row on the next flush. Use this for child entities that have no meaning without their parent (e.g. invoice line items).Update raises an exception if the same id is already cached under a different instance — use Merge<T> in that case.Merge<T>, the returned object is the managed one; the transient object you passed in is not managed — free it yourself.BeginTransaction is called on the connection (Manager.Connection.BeginTransaction), not on the manager itself.Rollback in the except block and re-raise — never swallow the exception.Commit/Rollback hits the database.CachedUpdates = True and the entity uses database-generated ids (identity/autoincrement), the INSERT is executed immediately even though other SQL is deferred — because the generated id is needed to proceed.[Version]EVersionedConcurrencyControl on flush. Handle it by refreshing the object and retrying the operation.For full method signatures, code examples, and details on all operations, read references/objects.md.
The reference covers: TObjectManager creation and TAureliusManager component, memory management (transient vs. persistent, unique instances, ownership transfer), saving objects (simple, with associations, cascades, collections), updating (flush, Update, Merge, Replicate, updating associations), finding objects (by id, fluent query builder, querying through associations, eager vs. lazy navigation), refreshing, removing (with and without cascade), evicting, transactions, concurrency control (changed-field detection, entity versioning), cached updates, and batch/bulk updates.
development
Use when writing Delphi / FreePascal / C++Builder code that reads, writes, manipulates, or exports Excel (.xlsx / .xls) files, generates PDF or HTML from Excel, or produces data-driven reports with FlexCel Studio for VCL and FireMonkey (TMS FlexCel). Triggers include Excel/xlsx from Delphi, TXlsFile, TFlexCelReport, TFlexCelPdfExport, TFlexCelHtmlExport, FireMonkey Excel export, Lazarus Excel, and Excel reporting from Pascal.
development
Use when writing C# / VB.NET / F# code that reads, writes, manipulates, or exports Excel (.xlsx / .xls) files, generates PDF or HTML from Excel, or produces data-driven reports with FlexCel Studio for .NET (TMS Software). Triggers include Excel/xlsx from C#, XlsFile, FlexCelReport, FlexCelPdfExport, FlexCelHtmlExport, FlexCelImgExport, ExcelFile, PdfWriter, .NET Excel export, ASP.NET Excel generation, .NET MAUI Excel, Native AOT + Excel, and Excel reporting from .NET.
testing
Map Delphi classes to a relational database using TMS Aurelius ORM attributes. Use when the user asks to create entity classes, add Aurelius mapping to existing classes, fix or review mapping attributes, explain how a class is mapped, or work with associations, inheritance, automapping, nullable fields, blobs, or composite identifiers. Triggers on requests like "create Aurelius entities for...", "map this class to Aurelius", "add ORM mapping", "fix the mapping on this class", "how do I map a one-to-many in Aurelius".
testing
Create, edit, improve, or audit AgentSkills. Use when creating a new skill from scratch or when asked to improve, review, audit, tidy up, or clean up an existing skill or SKILL.md file. Also use when editing or restructuring a skill directory (moving files to references/ or scripts/, removing stale content, validating against the AgentSkills spec). Triggers on phrases like "create a skill", "author a skill", "tidy up a skill", "improve this skill", "review the skill", "clean up the skill", "audit the skill".