SaveChangesAsync

Part of the QSAppContext object. Commits all pending changes that were made to the current screen model (the Qss object) back to the database. Qss is a globally available framework object that holds the field values of the active screen, and it is modified both by user actions in the UI and by code statements like Qss["NameAr"] = "new name".

This method does not depend on any batch ID or explicit operation queue – it automatically tracks all modifications applied to Qss and persists them in a single transaction.

Signature

public async Task<int> SaveChangesAsync()

Parameters

This method takes no parameters.

Returns

A Task<int> that represents the asynchronous save operation. The integer result typically indicates the number of rows affected by the update (e.g., 1 if the model corresponds to a single record, or more if it spans multiple records). A return value of 0 means no changes were detected to persist.

Example Usage

// Qss is directly available in only cSharp blocks
Qss["NameAr"] = "الاسم الجديد";
Qss["Email"] = "updated@example.com";

// Persist all modifications to the database
int rowsAffected = await QSAppContext.SaveChangesAsync();

Console.WriteLine($"Saved changes: {rowsAffected} row(s) affected");