Skip to content

SQL-246: PolicyExtensions.GenerateAgencies

This statement is a create operation invoked through ORM (IRepository.Add). Executed by PolicyExtensions.GenerateAgencies.

Classification

Field Value
SQL ID SQL-246
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 GenerateAgencies

Tables

Table Access Columns used
Agency INSERT ×5 (hypothetical) agency_seq_num, agency_name, agency_eff_date, agency_exp_date, policy_holder_paperless_flag, agency_paperless_flag, agency_paperless_request_flag, update_date, update_user, agency_rep_user

LINQ statement

Source: Data/SAIF.Data/TestRepository/RepositoryExtensions/PolicyExtensions.cs:30.

// Data/SAIF.Data/TestRepository/RepositoryExtensions/PolicyExtensions.cs:30
var agencies = uow.GetRepository<Agency>();

// Data/SAIF.Data/TestRepository/RepositoryExtensions/PolicyExtensions.cs:35-44
var agency = new Agency
{
    Id = i,
    Name = string.Concat("Agency #", i),
    EffectiveDate = new DateTime(DateTime.Today.Year - 2, 1, 1),
    IsPaperlessForPolicyHolderCopyOfDocuments = false,
    IsPaperlessForAgencyCopyOfDocuments = false,
    IsPaperlessForAgencyRequested = false
};
agencies.Add(agency);

Sample SQL

Test double — no runtime SQL. This statement executes against TestUnitOfWork/TestRepository<T> (in-memory, List<TEntity>-backed test doubles in SAIF.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 NHibernate IUnitOfWork using 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 Agency (
  agency_seq_num,
  agency_name,
  agency_eff_date,
  agency_exp_date,
  policy_holder_paperless_flag,
  agency_paperless_flag,
  agency_paperless_request_flag,
  update_date,
  update_user,
  agency_rep_user)
VALUES (
  :Id /* pre-fetched: SELECT agency_seq.NEXTVAL FROM DUAL */,
  :Name,
  :EffectiveDate,
  :ExpirationDate,
  :IsPaperlessForPolicyHolderCopyOfDocuments,
  :IsPaperlessForAgencyCopyOfDocuments,
  :IsPaperlessForAgencyRequested,
  :UpdateDate,
  :UpdateUser,
  :SAIFRepresentative)

Translation notes: - Scope split: SQL-246 and SQL-280 cite the same line (30). SQL-246 documents the INSERT (agencies.Add, line 44); SQL-280 documents the First() read at line 56. - GeneratedBy.Native("agency_seq") on Oracle → sequence; the explicitly assigned Id = i would be ignored/overwritten by the generator on a real session. - IsPaperless* flags are YesNoType ('N').

Sources

  • Data/SAIF.Data/TestRepository/RepositoryExtensions/PolicyExtensions.cs:30