dal-sql-access-patterns

Enforces centralized SQL Server access through AccesoDatosSqlServer with mandatory transactions.

Updated Aug 24, 2026
One-click install
npx skills add https://github.com/aggutierrez98/TP-TD --skill dal-sql-access-patterns-aggutierrez98
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: dal-sql-access-patterns
Source: https://github.com/aggutierrez98/TP-TD/tree/main/.agents/skills/dal-sql-access-patterns
Command: npx skills add https://github.com/aggutierrez98/TP-TD --skill dal-sql-access-patterns-aggutierrez98

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Data access layers often become inconsistent when entity DAL classes create their own SqlConnection and SqlTransaction objects, leading to scattered connection handling, missing transactions, and hard-to-maintain database code. This Skill enforces a single repository pattern so every SQL Server operation flows through one centralized class. ## Core Features & Use Cases - Centralized SQL Access: Routes all database operations through DAL/AccesoDatosSqlServer.cs, which owns connection open/close, transaction begin/commit/rollback, and command and parameter creation. - ConfigurationManager Connection Strings: Requires connection strings to be read from ConfigurationManager.ConnectionStrings instead of hardcoded values. - Mandatory Transactions: Enforces SQL transactions for every database operation, including both reads and writes. - Use Case: When adding a new entity DAL class that inserts records into SQL Server, the Skill ensures the class only defines SQL and parameters, delegates execution to AccesoDatosSqlServer, and maps DataTable results to BE entities. ## Quick Start Use the dal-sql-access-patterns skill to review my new entity DAL class and make sure all SQL access goes through AccesoDatosSqlServer with transactions.

Frequently Asked Questions about dal-sql-access-patterns

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

FAQPage Schema
How do I centralize SQL Server access in a .NET DAL layer?▼

Centralize SQL Server access by routing every database operation through a single class like AccesoDatosSqlServer that owns connections, transactions, commands, and parameters. Entity DAL classes should only define SQL, delegate execution, and map results to entities.

How to enforce transactions for all database operations in C#?▼

Enforce transactions by placing BeginTransaction, commit, and rollback logic exclusively inside the central data access class. Entity DAL classes must never call BeginTransaction directly, ensuring every read and write runs under a SQL transaction.

Should entity DAL classes create SqlConnection directly?▼

No, entity DAL classes should never create SqlConnection or SqlTransaction directly. Connection management belongs in the centralized AccesoDatosSqlServer class, while entity classes only define SQL statements and parameters and map DataTable results to BE entities.

How do I validate DAL changes follow the repository pattern?▼

Validate DAL changes by confirming no SqlConnection or BeginTransaction calls exist outside AccesoDatosSqlServer, then compiling the solution (TpIDS.sln). Connection strings must come from ConfigurationManager.ConnectionStrings.

When should reads also run inside SQL transactions?▼

Reads should run inside transactions when consistency rules require it, as this pattern mandates transactions for every database operation including reads and writes. This keeps transaction handling uniform and centralized in one class.