Skip to content

SQL-204: Retrieve Image via GetDataImage

This statement loads a single Image record by its identifier so that ImageService.GetDataImage can return the stored image data. It is issued through NHibernate LINQ against the Image entity from Services/SAIF.Services/Agencies/Imaging/ImageService.cs:219. The Image entity's mapping lives in the external SAIF.Framework.Data.NHibernate package; Legends resolved the backing table (image) but not its column names (see the Tables section).

Classification

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

Parameters

Parameter Direction Type Max length Description
:id Input long N/A i.Id == id

Tables

Table Access Columns used
image** SELECT Id (unresolved), all mapped columns (unresolved)

LINQ statement

Source: Services/SAIF.Services/Agencies/Imaging/ImageService.cs:219

var image = unitOfWork.GetRepository<Data.Model.Imaging.Image>().Query().Single(i => i.Id == id);

Sample SQL

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
SELECT I.* /* full ImageMap column list */      -- unresolved mapping: Image.*
FROM   image I
WHERE  I.Id = :id;                                -- unresolved mapping: Image.Id
-- NHibernate expects at most one row

Translation notes: - Image (Data.Model.Imaging.Image) has no in-repo ClassMap; its mapping lives in the external SAIF.Framework.Data.NHibernate package. Legends resolved the table (image) but not the column names, so the columns above use the C# property names with -- unresolved mapping: comments, and the table is marked **. - Single throws if no row.

Operations and processes

Sources

  • Services/SAIF.Services/Agencies/Imaging/ImageService.cs (L219)