示例#1
0
        public virtual async Task <bool> MigrateData(string sourceProjectId, string destinationProjectId)
        {
            bool noErrors = true;

            var list = await sourceQuery.GetAllAsync(sourceProjectId).ConfigureAwait(false);

            foreach (var obj in list)
            {
                try
                {
                    string key = keyResolver.GetKey(obj);
                    await targetCommand.CreateAsync(destinationProjectId, key, obj).ConfigureAwait(false);
                }
                catch (Exception ex)
                {
                    noErrors = false;
                    if (options.ContinueAfterError)
                    {
                        log.LogError("swallowed exception", ex);
                        continue;
                    }
                    else
                    {
                        throw ex;
                    }
                }
            }

            return(noErrors);
        }