Example #1
0
        private bool TryMergeEntities(string table, Metadata tableMetadata, StagingMetadata stagingMetadata)
        {
            // TODO: make this configurable, consider making it memory-based rather than count-based (after switching to System.Text.Json)
            const int batchSize = 10000;

            using var enumerator = new EntityEnumerator(_context, table, tableMetadata, stagingMetadata);
            while (!enumerator.Finished)
            {
                if (!_context.LocalStore.TryUpsertEntities(table, tableMetadata, enumerator.Take(batchSize)))
                {
                    return(false);
                }

                enumerator.Flush();
            }

            return(true);
        }