SQL-248: PolicyExtensions.GenerateDefaultPolicies¶
This statement is a create operation invoked through ORM (IRepository.Add). Executed by PolicyExtensions.GenerateDefaultPolicies.
Classification¶
| Field | Value |
|---|---|
| SQL ID | SQL-248 |
| Operation type | Create |
| Execution method | ORM (IRepository.Add) |
| Database | Oracle* |
| Schema | [unqualified]** |
| Command type | N/A (ORM-generated) |
| Business object | PolicyExtensions |
| Criteria property | N/A — ORM |
| Lifecycle method | GenerateDefaultPolicies |
Tables¶
| Table | Access | Columns used |
|---|---|---|
| POLICY_TEAM_FUNCTION | INSERT ×24 (hypothetical) | POLICY_NUM, TEAM_FUNCTION_CODE, UPDATE_DATE, UPDATE_USER, USER_NAME |
LINQ statement¶
Source: Data/SAIF.Data/TestRepository/RepositoryExtensions/PolicyExtensions.cs:63.
// Data/SAIF.Data/TestRepository/RepositoryExtensions/PolicyExtensions.cs:63
var polTeam = uow.GetRepository<PolicyTeamFunction>();
// Data/SAIF.Data/TestRepository/RepositoryExtensions/PolicyExtensions.cs:89-95
var policyTeam = new PolicyTeamFunction
{
PolicyNumber = i,
TeamFunctionCode = "MKTRP",
WcisEmployee = new WcisEmployee { FirstName = "Marketing", Id = "MARREP", LastName = "Representative" }
};
polTeam.Add(policyTeam);
Sample SQL¶
Test double — no runtime SQL. This statement executes against
TestUnitOfWork/TestRepository<T>(in-memory,List<TEntity>-backed test doubles inSAIF.Framework.Core); no NHibernate session is opened and no SQL is issued at runtime. The SQL below is the hypothetical statement the same expression would produce against a real NHibernateIUnitOfWorkusing the in-repo mappings, shown to document the mapping shape only — no database table is accessed when this code runs.Inferred SQL: This SQL was inferred from the LINQ statement above and the NHibernate mappings. It is not concrete SQL from source code; NHibernate generates the executed statement at runtime, so aliases, column order, join syntax, and bind-parameter names may differ.
-- Inferred from LINQ (NHibernate mapping translation); not concrete SQL
INSERT INTO POLICY_TEAM_FUNCTION (
POLICY_NUM,
TEAM_FUNCTION_CODE,
UPDATE_DATE,
UPDATE_USER,
USER_NAME)
VALUES (
:PolicyNumber,
:TeamFunctionCode,
:UpdateDate,
:UpdateUser,
:WcisEmployee)
Translation notes:
- Scope split: SQL-248 and SQL-281 cite the same line (63). SQL-248 documents the INSERT (polTeam.Add, line 95); SQL-281 documents the read at line 96.
- Not accessed: WCIS_EMPLOYEE (or equivalent) — WcisEmployee = new WcisEmployee {...} is a transient reference mapped only through the FK column USER_NAME (References(x => x.WcisEmployee).Column("USER_NAME")); no read and no cascade. WcisEmployee has no in-repo ClassMap and is not needed because it is never queried.
- Composite id (POLICY_NUM, TEAM_FUNCTION_CODE) is assigned by the caller.
Sources¶
Data/SAIF.Data/TestRepository/RepositoryExtensions/PolicyExtensions.cs:63