sdk/dotnet/src/Microsoft.Datasync.Client.SQLiteStore/OfflineSQLiteStore.cs
/// <summary>
/// Do a batch update to set the list of columns for the list of items in the given table.
/// </summary>
/// <param name="tableName">The table to update.</param>
/// <param name="items">The list of items to update (with new values).</param>
/// <param name="columns">The list of columns to update.</param>
Do a batch update to set the list of columns for the list of items in the given table.
Do a batch update to set the list of columns for the list of items in the given table .
protected void BatchUpdate(string tableName, IEnumerable<JObject> items, List<ColumnDefinition> columns)
        {
            if (columns.Count <= 1)
            {
                return;
            }
            if (columns.Count > DbConnection.MaxParametersPerQuery)
            {
                throw new InvalidOperationException($"The number of fields per entity in an upsert is limited to {DbConnection.MaxParametersPerQuery}");
            }
            foreach (JObject item in items)
            {
                string sql = SqlStatements.BatchUpdate(tableName, columns, item, out Dictionary<string, object> parameters);
                if (sql != null)
                {
                    ExecuteNonQueryInternal(sql, parameters);
                }
            }
        }
protected void BatchUpdate ( string tableName , IEnumerable < JObject > items , List < ColumnDefinition > columns ) { if ( columns . Count <= 1 ) { return ; } if ( columns . Count > DbConnection . MaxParametersPerQuery ) { throw new InvalidOperationException ( $" The number of fields per entity in an upsert is limited to  { DbConnection . MaxParametersPerQuery } " ) ; } foreach ( JObject item in items ) { string sql = SqlStatements . BatchUpdate ( tableName , columns , item , out Dictionary < string , object > parameters ) ; if ( sql != null ) { ExecuteNonQueryInternal ( sql , parameters ) ; } } }
Do a batch update to set the list of columns for the list of items in the given table.
Do a batch update to set the list of columns for the list of items in the given table .
// For batch updates to work, there has to be at least one column desides Id that needs to be updated.
tableName
string
The table to update.
The table to update .
items
IEnumerable<JObject>
The list of items to update (with new values).
The list of items to update ( with new values ) .
columns
List<ColumnDefinition>
The list of columns to update.
The list of columns to update .