Skip to content

SQL-270: EbillingExtensions.SeedForEbilling

This statement is a read operation invoked through ORM (NHibernate LINQ). Executed by EbillingExtensions.SeedForEbilling.

Classification

Field Value
SQL ID SQL-270
Operation type Read
Execution method ORM (NHibernate LINQ)
Database Oracle*
Schema [unqualified]**
Command type N/A (ORM-generated)
Business object EbillingExtensions
Criteria property N/A — ORM
Lifecycle method SeedForEbilling

Tables

Table Access Columns used
EBILL_DOCUMENT_TYPE_CODE INSERT ×89 (hypothetical) CODE, CODE_DESCR, IMAGE_FILE_CODE, UPDATE_USER, UPDATE_DATE, UPDATE_NUM, NEW_CLAIM_FLAG, EBILL_SET_TYPE_CODE, OB_DOC_TYPE_SEQ_NUM, OB_DOC_SUB_TYPE_SEQ_NUM, OB_DOC_TYPE_GROUP_SEQ_NUM

LINQ statement

Source: Data/SAIF.Data/TestRepository/RepositoryExtensions/EbillingExtensions.cs:18.

// Data/SAIF.Data/TestRepository/RepositoryExtensions/EbillingExtensions.cs:18
uow.GetRepository<EbillDocumentTypeCode>().Seed();

// Data/SAIF.Data/TestRepository/RepositoryExtensions/EbillingExtensions.cs:100-202
public static void Seed(this IRepository<EbillDocumentTypeCode> repository)
{

    //--select 'repository.Add(new EbillDocumentTypeCode { Code = "' || code || 
    //--'", Description = "' || code_descr || '", ImageCategoryCode = "' || image_category_code || 
    //--'", ImageDocumentTypeCode = "' || image_document_type_code || 
    //--'", ImageFileCode = "CLAIM", IsNewClaim = ' || decode(new_claim_flag, 'Y', 'true', 'N', 'false') || 
    //--', SetType = new EbillSetTypeCode { Code = "' || ebill_set_type_code || '" }});' as code
    //--from ebill_document_type_code;
    //--
    //--select * from ebill_document_type_code;
    //OnBaseDocumentType = new OnBaseDocumentType() { DocumentType = "M" }, OnBaseDocumentSubtype = new OnBaseDocumentSubType() { SubType = "REC" }
    repository.Add(new EbillDocumentTypeCode { Code = "blank", Description = "Unknown", OnBaseDocumentType = new OnBaseDocumentType() { DocumentType = "M" }, OnBaseDocumentSubtype = new OnBaseDocumentSubType() { SubType = "REC" }, ImageFileCode = "CLAIM", IsNewClaim = false, SetType = new EbillSetTypeCode { Code = "" } });
    // ... 88 further Add/AddCode call(s) through line 202 (elided)
}

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 EBILL_DOCUMENT_TYPE_CODE (
  CODE,
  CODE_DESCR,
  IMAGE_FILE_CODE,
  UPDATE_USER,
  UPDATE_DATE,
  UPDATE_NUM,
  NEW_CLAIM_FLAG,
  EBILL_SET_TYPE_CODE,
  OB_DOC_TYPE_SEQ_NUM,
  OB_DOC_SUB_TYPE_SEQ_NUM,
  OB_DOC_TYPE_GROUP_SEQ_NUM)
VALUES (
  :Code,
  :Description,
  :ImageFileCode,
  :UpdateUser,
  :UpdateDate,
  :UpdateNumber,
  :IsNewClaim,
  :SetType,
  :OnBaseDocumentType,
  :OnBaseDocumentSubtype,
  :OnBaseDocumentTypeGroup)
-- issued 89 time(s) (one per repository.Add, lines 100-202)

Translation notes: - Not accessed: EBILL_SET_TYPE_CODE and the OnBase document-type tables — SetType = new EbillSetTypeCode { Code = ... } and OnBaseDocumentType/SubType/TypeGroup = new ... are transient references that contribute FK values (EBILL_SET_TYPE_CODE, OB_DOC_TYPE_SEQ_NUM, OB_DOC_SUB_TYPE_SEQ_NUM, OB_DOC_TYPE_GROUP_SEQ_NUM) only; no cascade, no read. - Rows are added directly with repository.Add(new T {...}) (no existence probe). - UPDATE_NUM is a plain Map (not Version) on this entity. NEW_CLAIM_FLAG is YesNoType. - Transient references without cascade would raise TransientObjectException at flush on a real session.

Sources

  • Data/SAIF.Data/TestRepository/RepositoryExtensions/EbillingExtensions.cs:18