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 BatchInsert(string tableName, IEnumerable<JObject> items, List<ColumnDefinition> columns)
        {
            int batchSize = DbConnection.MaxParametersPerQuery / columns.Count;
            if (batchSize == 0)
            {
                throw new InvalidOperationException($"The number of fields per entity in an upsert is limited to {DbConnection.MaxParametersPerQuery}");
            }
            foreach (var batch in items.Split(maxLength: batchSize))
            {
                var sql = SqlStatements.BatchInsert(tableName, columns, batch, out Dictionary<string, object> parameters);
                if (sql != null)
                {
                    ExecuteNonQueryInternal(sql, parameters);
                }
            }
        }
protected void BatchInsert ( string tableName , IEnumerable < JObject > items , List < ColumnDefinition > columns ) { int batchSize = DbConnection . MaxParametersPerQuery / columns . Count ; if ( batchSize == 0 ) { throw new InvalidOperationException ( $" The number of fields per entity in an upsert is limited to  { DbConnection . MaxParametersPerQuery } " ) ; } foreach ( var batch in items . Split ( maxLength : batchSize ) ) { var sql = SqlStatements . BatchInsert ( tableName , columns , batch , 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 .
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 .