一键导入
ewl-data-access
EWL generated data access layer including table retrievals, modifications, row constants, sequences, and caching
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
EWL generated data access layer including table retrievals, modifications, row constants, sequences, and caching
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Configure opencode on a new development machine for EWL work by creating the global AGENTS.md and granting access to the EWL source, EWL System Manager source, EWL folder, and EWL client systems directory. Use when setting up opencode on a new machine, or when the user asks to bootstrap, initialize, or configure global opencode for EWL.
Run local EWL Development Utility (DU) operations on EWL systems. Use when asked to run DU operations such as sync or update-data against a particular path or system.
Database schema migration using FluentMigrator with the EWL Data Migrator project
Inspect and troubleshoot EWL systems hosted in Azure — locating an installation's App Service, Container App Job, and Log Analytics workspace, and reliably reading Container App (data migrator) console and system logs. Use when checking whether a deploy's data migrator ran, reading container logs for a hosted installation, or investigating an installation's Azure resources. Companion to ewl-azure-pipelines, which covers the build/deploy pipelines that create these resources.
Test changes to EWL agent rules, subagents, skills, OpenCode plugins, and MCP tools by driving OpenCode headlessly, capturing transcripts, and cleaning up afterwards. Load this skill when verifying changes to anything under Library\Files\Agent Rules.md, Library\Files\Agents\, Library\Files\Agent Skills\, Library\Files\OpenCode Plugins\, or Library\Files\OpenCode Tools\.
Azure Pipelines CI/CD for EWL systems including build templates, deploy templates, and pipeline code generation
| name | ewl-data-access |
| description | EWL generated data access layer including table retrievals, modifications, row constants, sequences, and caching |
The Development Utility generates data-access classes from your database
schema. These live in Generated Code\ folders and must never be edited
directly. You can extend them with hand-written partial class files.
Run sync after any schema change to regenerate.
Generated *TableRetrieval classes provide typed read access:
// Get all rows
var rows = ServiceOrdersTableRetrieval.GetRows();
// Get rows matching a condition
var rows = ServiceOrdersTableRetrieval.GetRows(
new ServiceOrdersTableEqualityConditions.CustomerId( customerId ) );
// Get a single row by primary key (throws if not found)
var row = ServiceOrdersTableRetrieval.GetRowMatchingPk( serviceOrderId );
// Try to get a single row (returns false if not found)
if( ServiceOrdersTableRetrieval.TryGetRowMatchingPk( id, out var row ) )
// use row
// For small/cached tables
var allRows = ServiceTypesTableRetrieval.GetAllRows();
Row objects expose typed properties for each column (e.g. row.CustomerName,
row.ServiceTypeId).
Generated *Modification classes provide insert, update, and delete:
// Insert
var mod = ServiceOrdersModification.CreateForInsert();
mod.ServiceOrderId = MainSequence.GetNextValue();
mod.CustomerName = "Jane Doe";
mod.CustomerEmail = "jane@example.com";
mod.Execute();
// Update from a condition
var mod = UsersModification.CreateForUpdate(
new UsersTableEqualityConditions.UserId( userId ) );
mod.EmailAddress = newEmail;
mod.Execute();
// Update from a row (common pattern)
var mod = serviceOrderRow.ToModification();
mod.CustomerName = "Updated Name";
mod.Execute();
// Delete
ServiceOrdersModification.DeleteRows(
new ServiceOrdersTableEqualityConditions.ServiceOrderId( id ) );
// Insert with all columns in one call
UsersModification.InsertRow( userId, email, roleId, 0, null, null, null, null, null, "" );
All new entity IDs use the main sequence, never auto-increment:
mod.ServiceOrderId = MainSequence.GetNextValue();
Lookup tables declared in Development.xml as rowConstantTables produce
generated constant classes:
UserRolesRows.Administrator
ServiceTypesRows.GeneralService
EmailTemplatesRows.Reminder
Configure in Development.xml:
<database>
<rowConstantTables>
<table tableName="UserRoles" nameColumn="RoleName" valueColumn="UserRoleId" />
</rowConstantTables>
<SmallTables>
<Table>UserRoles</Table>
</SmallTables>
</database>
Modification objects generate form controls directly. This is the primary way forms are built in EWL:
mod.GetCustomerNameFormItem( false )
mod.GetCustomerEmailFormItem( false )
mod.GetServiceTypeIdDropDownFormItem( DropDownSetup.Create( items ), "" )
mod.GetNotesFormItem( true, controlSetup: TextControlSetup.Create( numberOfRows: 4 ) )
The first boolean parameter controls whether the field is optional. Control types are inferred from column names (e.g. "Email" columns get email controls).
Create partial classes alongside the .ewlt.cs files to add custom logic:
partial class UsersModification {
static partial void populateConstraintNamesToViolationErrorMessages(
Dictionary<string, string> constraintNamesToViolationErrorMessages ) {
constraintNamesToViolationErrorMessages.Add(
"UsersEmailAddressUnique", "A user with this email address already exists." );
}
}
Available partial methods for modifications: preInsert, postInsert,
preUpdate, postUpdate, preDelete,
populateConstraintNamesToViolationErrorMessages.
For retrievals, add extension methods or computed properties on the Row
class:
public static IEnumerable<Row> Active( this IEnumerable<Row> rows ) =>
rows.Where( i => i.IsActive );
Create a companion YourDataTableEwlModifications table containing only the
main table's primary key column(s). This enables change-tracking cache
invalidation so that large queries become tiny queries while never returning
stale data.
Requirements:
Tables in revisionHistoryTables in Development.xml get automatic
versioning. Retrieval and modification classes are revision-history-aware:
retrievals return only the latest revision, and modifications automatically
create new revisions.
Custom retrieval queries are NOT revision-history-aware; you must join:
SELECT s.* FROM SomeTableRevisions s
JOIN Revisions r ON r.RevisionId = s.SomeTableRevisionId
AND r.LatestRevisionId = r.RevisionId