Пример #1
0
        public DatabaseSmuggler(DocumentDatabase database, ISmugglerSource source, ISmugglerDestination destination, SystemTime time,
                                DatabaseSmugglerOptionsServerSide options = null, SmugglerResult result = null, Action <IOperationProgress> onProgress = null,
                                CancellationToken token = default)
        {
            _database    = database;
            _source      = source;
            _destination = destination;
            _options     = options ?? new DatabaseSmugglerOptionsServerSide();
            _result      = result;
            _token       = token;

            if (string.IsNullOrWhiteSpace(_options.TransformScript) == false)
            {
                _patcher = new SmugglerPatcher(_options, database);
            }

            _time       = time;
            _onProgress = onProgress ?? (progress => { });
        }
Пример #2
0
        public DatabaseSmuggler(DocumentDatabase database, ISmugglerSource source, ISmugglerDestination destination, SystemTime time,
                                DatabaseSmugglerOptionsServerSide options = null, SmugglerResult result = null, Action <IOperationProgress> onProgress = null,
                                CancellationToken token = default)
        {
            _database    = database;
            _source      = source;
            _destination = destination;
            _options     = options ?? new DatabaseSmugglerOptionsServerSide();
            _result      = result;
            _token       = token;

            if (string.IsNullOrWhiteSpace(_options.TransformScript) == false)
            {
                _patcher = new SmugglerPatcher(_options, database);
            }

            Debug.Assert((source is DatabaseSource && destination is DatabaseDestination) == false,
                         "When both source and destination are database, we might get into a delayed write for the dest while the " +
                         "source already pulsed its' read transaction, resulting in bad memory read.");

            _time       = time;
            _onProgress = onProgress ?? (progress => { });
        }