SQL-042: Create Preference via SavePreferences¶
This ORM statement performs a create operation on Preference via SavePreferences, executed from Services/SAIF.Services/Claims/Notes/NotePreferenceConversionService.cs (L113).
Classification¶
| Field | Value |
|---|---|
| SQL ID | SQL-042 |
| Operation type | Create |
| Execution method | ORM (IRepository.Add) |
| Database | Oracle |
| Schema | [unqualified]** |
| Command type | N/A (ORM-generated) |
| Business object | Preference |
| Criteria property | N/A — ORM |
| Lifecycle method | SavePreferences |
Parameters¶
| Parameter | Direction | Type | Max length | Description |
|---|---|---|---|---|
:Id |
Input | long |
N/A | Property of Preference |
:UserId |
Input | string |
N/A | Property of Preference (column pairing unresolved) |
:ApplicationName |
Input | string |
N/A | Property of Preference (column pairing unresolved) |
:PageName |
Input | string |
N/A | Property of Preference (column pairing unresolved) |
:PreferenceText |
Input | string |
N/A | Property of Preference |
:UpdateDate |
Input | DateTime |
N/A | Property of Preference |
:UpdateUser |
Input | string |
N/A | Property of Preference |
Tables¶
| Table | Access | Columns used |
|---|---|---|
| USER_PREFERENCE** | INSERT | USER_PREFERENCE_SEQ_NUM, USER_ID, APP_NAME, PAGE_NAME, PREFERENCE_TEXT, UPDATE_DATE, UPDATE_USER |
LINQ statement¶
Source: Services/SAIF.Services/Claims/Notes/NotePreferenceConversionService.cs:113.
// Services/SAIF.Services/Claims/Notes/NotePreferenceConversionService.cs:96
var prefs = new Preference
{
ApplicationName = "ClaimTasksNotes",
PageName = "ClaimNoteDefaults",
UserId = userName,
PreferenceText = Serializer.SerializeToJson(new Dictionary<string, string>
{
{"CategoryCode", category},
{"TypeCode", type},
{"ExternalView", externalView}
}),
UpdateDate = DateTime.Now,
UpdateUser = "CTNCONV"
};
// Services/SAIF.Services/Claims/Notes/NotePreferenceConversionService.cs:113
unitOfWork.GetRepository<Preference>().Add(prefs);
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 USER_PREFERENCE_SEQ.NEXTVAL
FROM DUAL
INSERT INTO USER_PREFERENCE (
USER_PREFERENCE_SEQ_NUM,
USER_ID, -- unresolved mapping: Preference.UserId (column pairing inferred)
APP_NAME, -- unresolved mapping: Preference.ApplicationName (column pairing inferred)
PAGE_NAME, -- unresolved mapping: Preference.PageName (column pairing inferred)
PREFERENCE_TEXT,
UPDATE_DATE,
UPDATE_USER)
VALUES (
:Id,
:UserId,
:ApplicationName,
:PageName,
:PreferenceText,
:UpdateDate,
:UpdateUser)
Translation notes:
- Preference (SAIF.Data.Model.Preferences) is mapped outside this repository (no in-repo ClassMap<Preference>). Legends reports PreferencesMap in SAIF.Framework.Data.NHibernate with table USER_PREFERENCE and native sequence USER_PREFERENCE_SEQ; the ClassMap source is not indexed.
- Columns are taken from the SAIF.Framework.Preferences USER_PREFERENCE table docs and its documented ADO.NET insert (IT.BOF.Framework/docs/libraries/saif-framework-preferences/sql/SQL-004-insert-preference.md, via Legends); not ClassMap-verified. Pairings whose names differ (UserId, ApplicationName, PageName) are marked -- unresolved mapping.
- :Id is the value fetched from USER_PREFERENCE_SEQ before the INSERT.
- The call site wraps the Add in unitOfWork.Begin() / Commit() (lines 112-114), so the INSERT is flushed at commit.
Operations and processes¶
- NotePreferenceConversionService.SavePreferences — see Operations and processes
Note: Statements marked with
**could not be confirmed; treat as unknown until verified.
Sources¶
Services/SAIF.Services/Claims/Notes/NotePreferenceConversionService.cs (L113)