当前位置: 首页>>代码示例>>C#>>正文


C# SmugglerDatabaseApi.ExportData方法代码示例

本文整理汇总了C#中Raven.Smuggler.SmugglerDatabaseApi.ExportData方法的典型用法代码示例。如果您正苦于以下问题:C# SmugglerDatabaseApi.ExportData方法的具体用法?C# SmugglerDatabaseApi.ExportData怎么用?C# SmugglerDatabaseApi.ExportData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Raven.Smuggler.SmugglerDatabaseApi的用法示例。


在下文中一共展示了SmugglerDatabaseApi.ExportData方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: MaxNumberOfItemsToProcessInSingleBatchShouldBeRespectedBySmuggler

		public void MaxNumberOfItemsToProcessInSingleBatchShouldBeRespectedBySmuggler()
		{
			var path = Path.Combine(NewDataPath(forceCreateDir: true), "raven.dump");

			using (var server = GetNewServer(configureConfig: configuration => configuration.MaxNumberOfItemsToProcessInSingleBatch = 1234))
			{
                var smuggler = new SmugglerDatabaseApi(options: new SmugglerDatabaseOptions { BatchSize = 4321 });
				Assert.Equal(4321, smuggler.Options.BatchSize);

                smuggler.ExportData(new SmugglerExportOptions<RavenConnectionStringOptions> { ToFile = path, From = new RavenConnectionStringOptions { Url = server.Configuration.ServerUrl } }).ResultUnwrap();

				Assert.Equal(1234, smuggler.Options.BatchSize);

                smuggler = new SmugglerDatabaseApi(options: new SmugglerDatabaseOptions { BatchSize = 4321 });
				Assert.Equal(4321, smuggler.Options.BatchSize);

                smuggler.ImportData(new SmugglerImportOptions<RavenConnectionStringOptions> { FromFile = path, To = new RavenConnectionStringOptions { Url = server.Configuration.ServerUrl } }).Wait();

				Assert.Equal(1234, smuggler.Options.BatchSize);

                smuggler = new SmugglerDatabaseApi(options: new SmugglerDatabaseOptions { BatchSize = 1000 });
				Assert.Equal(1000, smuggler.Options.BatchSize);

                smuggler.ExportData(new SmugglerExportOptions<RavenConnectionStringOptions> { ToFile = path, From = new RavenConnectionStringOptions { Url = server.Configuration.ServerUrl } }).ResultUnwrap();

				Assert.Equal(1000, smuggler.Options.BatchSize);
			}
		}
开发者ID:bbqchickenrobot,项目名称:ravendb,代码行数:28,代码来源:RavenDB_2605.cs

示例2: SmugglerShouldThrowIfDatabaseDoesNotExist

        public async Task SmugglerShouldThrowIfDatabaseDoesNotExist()
        {
            var path = Path.GetTempFileName();

            try
            {
                using (var store = NewRemoteDocumentStore())
                {
                    var connectionStringOptions =
                        new RavenConnectionStringOptions
                        {
                            Url = store.Url,
                            DefaultDatabase = "DoesNotExist"
                        };
                    var smuggler = new SmugglerDatabaseApi();

                    var e = await AssertAsync.Throws<SmugglerException>(() => smuggler.ImportData(
                        new SmugglerImportOptions<RavenConnectionStringOptions> { FromFile = path, To = connectionStringOptions }));

                    Assert.Equal(string.Format("Smuggler does not support database creation (database 'DoesNotExist' on server '{0}' must exist before running Smuggler).", store.Url), e.Message);

                    e = await AssertAsync.Throws<SmugglerException>(() => smuggler.ExportData(
                        new SmugglerExportOptions<RavenConnectionStringOptions> { ToFile = path, From = connectionStringOptions }));

                    Assert.Equal(string.Format("Smuggler does not support database creation (database 'DoesNotExist' on server '{0}' must exist before running Smuggler).", store.Url), e.Message);
                }
            }
            finally
            {
                IOExtensions.DeleteFile(path);
            }
        }
开发者ID:JackWangCUMT,项目名称:ravendb,代码行数:32,代码来源:SmugglerExecutionTests.cs

示例3: Sample

		public async void Sample()
		{
			#region smuggler_api_1
			// export Documents, Indexes, Attachments and Transformers
			// to dump.raven file
			// from Northwind database
			// found on http://localhost:8080 server
			SmugglerDatabaseApi smugglerApi = new SmugglerDatabaseApi(new SmugglerDatabaseOptions
			{
				OperateOnTypes =
					ItemType.Documents | ItemType.Indexes | ItemType.Attachments | ItemType.Transformers,
				Incremental = false
			});

			SmugglerExportOptions<RavenConnectionStringOptions> exportOptions = new SmugglerExportOptions<RavenConnectionStringOptions>
			{
				ToFile = "dump.raven",
				From = new RavenConnectionStringOptions
				{
					DefaultDatabase = "Northwind",
					Url = "http://localhost:8080"
				}
			};

			await smugglerApi.ExportData(exportOptions);
			#endregion
		}
开发者ID:modulexcite,项目名称:docs-8,代码行数:27,代码来源:ExportImport.cs

示例4: ImportingReplicationDestinationsDocumentWithInvalidSourceShouldReportOneAlertOnly

        public void ImportingReplicationDestinationsDocumentWithInvalidSourceShouldReportOneAlertOnly()
        {
            var store1 = CreateStore();
            var store2 = CreateStore();
            var store3 = CreateStore();

            TellFirstInstanceToReplicateToSecondInstance();

            store2.Dispose();

            store1.DatabaseCommands.Put("1", null, new RavenJObject(), new RavenJObject());
            store1.DatabaseCommands.Put("2", null, new RavenJObject(), new RavenJObject());

            var smuggler = new SmugglerDatabaseApi();

	        smuggler.ExportData(
                new SmugglerExportOptions<RavenConnectionStringOptions>
		        {
			        ToFile = DumpFile,
			        From = new RavenConnectionStringOptions
			        {
				        Url = store1.Url,
				        DefaultDatabase = store1.DefaultDatabase
			        }
		        }).Wait(TimeSpan.FromSeconds(15));
            Assert.True(File.Exists(DumpFile));

            smuggler = new SmugglerDatabaseApi();
	        smuggler.ImportData(
                new SmugglerImportOptions<RavenConnectionStringOptions>
		        {
			        FromFile = DumpFile,
			        To = new RavenConnectionStringOptions
			        {
				        Url = store3.Url,
				        DefaultDatabase = store3.DefaultDatabase
			        }
		        }).Wait(TimeSpan.FromSeconds(15));

            Assert.NotNull(store3.DatabaseCommands.Get("1"));
            Assert.NotNull(store3.DatabaseCommands.Get("2"));

	        int retries = 5;
	        JsonDocument container = null;
			while (container == null && retries-- >0)
	        {
		        container = store3.DatabaseCommands.Get("Raven/Alerts");
				if(container == null)
					Thread.Sleep(100);
	        }
	        Assert.NotNull(container);

            var alerts = container.DataAsJson["Alerts"].Values<RavenJObject>()
                .ToList();
            Assert.Equal(1, alerts.Count);

            var alert = alerts.First();
            Assert.True(alert["Title"].ToString().StartsWith("Wrong replication source:"));
        }
开发者ID:GorelH,项目名称:ravendb,代码行数:59,代码来源:ReplicationAlerts.cs

示例5: NegativeFiltersShouldNotFilterOutWhenThereAreNoMatches

        public void NegativeFiltersShouldNotFilterOutWhenThereAreNoMatches()
        {
            var path = Path.GetTempFileName();

	        var options = new SmugglerDatabaseOptions
		        {
			        Filters =
				        new EquatableList<FilterSetting>
				        {
					        new FilterSetting
					        {
						        Path = "Value",
						        ShouldMatch = false,
						        Values = new EquatableList<string> {"Value1"}
					        }
				        }
		        };

            try
            {
                using (var store = NewRemoteDocumentStore())
                {
                    Initialize(store);

                    var smuggler = new SmugglerDatabaseApi(options);
                    smuggler.ExportData(new SmugglerExportOptions<RavenConnectionStringOptions> { ToFile = path, From = new RavenConnectionStringOptions { Url = store.Url, DefaultDatabase = store.DefaultDatabase } }).Wait(TimeSpan.FromSeconds(15));
                }

                using (var store = NewRemoteDocumentStore())
                {
                    var smuggler = new SmugglerDatabaseApi(options);
                    smuggler.ImportData(new SmugglerImportOptions<RavenConnectionStringOptions> { FromFile = path, To = new RavenConnectionStringOptions { Url = store.Url, DefaultDatabase = store.DefaultDatabase } }).Wait(TimeSpan.FromSeconds(15));

                    Assert.NotNull(store.DatabaseCommands.Get("key/1"));

                    using (var session = store.OpenSession())
                    {
                        var product1 = session.Load<Product>(1);
                        var product2 = session.Load<Product>(2);
                        var product3 = session.Load<Product>(3);

                        Assert.Null(product1);
                        Assert.Null(product2);
                        Assert.NotNull(product3);
                    }
                }
            }
            finally
            {
                IOExtensions.DeleteDirectory(path);
            }
        }
开发者ID:GorelH,项目名称:ravendb,代码行数:52,代码来源:RDBQA_7.cs

示例6: DateTimePreserved

        public void DateTimePreserved()
        {
            var file = Path.GetTempFileName();

            try
            {
                var docId = string.Empty;

                using (var documentStore = NewRemoteDocumentStore())
                {
                    using (var session = documentStore.OpenSession())
                    {
                        var foo = new Foo {Created = DateTime.Today};
                        session.Store(foo);
                        docId = foo.Id;
                        session.SaveChanges();
                    }
                    var smugglerApi = new SmugglerDatabaseApi();
                    smugglerApi.ExportData(new SmugglerExportOptions<RavenConnectionStringOptions> { ToFile = file, From = new RavenConnectionStringOptions { Url = documentStore.Url, DefaultDatabase = documentStore.DefaultDatabase } }).Wait(TimeSpan.FromSeconds(15));
                }

                using (var documentStore = NewRemoteDocumentStore())
                {
                    var smugglerApi = new SmugglerDatabaseApi();
                    smugglerApi.ImportData(new SmugglerImportOptions<RavenConnectionStringOptions> { FromFile = file, To = new RavenConnectionStringOptions { Url = documentStore.Url, DefaultDatabase = documentStore.DefaultDatabase } }).Wait(TimeSpan.FromSeconds(15));
                    
                    using (var session = documentStore.OpenSession())
                    {
                        var created = session.Load<Foo>(docId).Created;
                        Assert.False(session.Advanced.HasChanges);
                    }
                }
            }
            finally
            {
                if (File.Exists(file))
                {
                    File.Delete(file);
                }
            }
        }
开发者ID:j2jensen,项目名称:ravendb,代码行数:41,代码来源:SmugglerTests.cs

示例7: SmugglerShouldNotThrowIfDatabaseExist1

        public async Task SmugglerShouldNotThrowIfDatabaseExist1()
        {
            var path = Path.GetTempFileName();

            try
            {
                using (var store = NewRemoteDocumentStore())
                {
                    store.DatabaseCommands.GlobalAdmin.EnsureDatabaseExists("DoesNotExist");

                    var connectionStringOptions = new RavenConnectionStringOptions { Url = store.Url, DefaultDatabase = "DoesNotExist" };
                    var smuggler = new SmugglerDatabaseApi();

                    await smuggler.ImportData(new SmugglerImportOptions<RavenConnectionStringOptions> { FromFile = path, To = connectionStringOptions });
                    await smuggler.ExportData(new SmugglerExportOptions<RavenConnectionStringOptions> { ToFile = path, From = connectionStringOptions });
                }
            }
            finally
            {
                IOExtensions.DeleteFile(path);
            }
        }
开发者ID:JackWangCUMT,项目名称:ravendb,代码行数:22,代码来源:SmugglerExecutionTests.cs

示例8: SmugglerWithoutExcludeExpiredDocumentsShouldWork

        public void SmugglerWithoutExcludeExpiredDocumentsShouldWork()
        {
            var path = Path.GetTempFileName();

            try
            {
                using (var store = NewRemoteDocumentStore())
                {
                    Initialize(store);

                    var smuggler = new SmugglerDatabaseApi();

                    smuggler.ExportData(new SmugglerExportOptions<RavenConnectionStringOptions> { ToFile = path, From = new RavenConnectionStringOptions { Url = store.Url, DefaultDatabase = store.DefaultDatabase } }).Wait(TimeSpan.FromSeconds(15));
                }

                using (var store = NewRemoteDocumentStore())
                {
                    var smuggler = new SmugglerDatabaseApi();

                    smuggler.ImportData(new SmugglerImportOptions<RavenConnectionStringOptions> { FromFile = path, To = new RavenConnectionStringOptions { Url = store.Url, DefaultDatabase = store.DefaultDatabase } }).Wait(TimeSpan.FromSeconds(15));

                    using (var session = store.OpenSession())
                    {
                        var product1 = session.Load<Product>(1);
                        var product2 = session.Load<Product>(2);
                        var product3 = session.Load<Product>(3);

                        Assert.NotNull(product1);
                        Assert.Null(product2);
                        Assert.NotNull(product3);
                    }
                }
            }
            finally
            {
                IOExtensions.DeleteDirectory(path);
            }
        }
开发者ID:j2jensen,项目名称:ravendb,代码行数:38,代码来源:RDBQA_11.cs

示例9: SmugglerShouldNotExportImportSubscribtionIdentities

        public async Task SmugglerShouldNotExportImportSubscribtionIdentities()
        {
            using (var store = NewRemoteDocumentStore())
            {
                store.Subscriptions.Create(new SubscriptionCriteria());

                var smuggler = new SmugglerDatabaseApi(new SmugglerDatabaseOptions { OperateOnTypes = ItemType.Documents });

                using (var stream = new MemoryStream())
                {
                    await smuggler.ExportData(new SmugglerExportOptions<RavenConnectionStringOptions>
                    {
                        From = new RavenConnectionStringOptions
                        {
                            DefaultDatabase = store.DefaultDatabase,
                            Url = store.Url
                        },
                        ToStream = stream
                    });

                    stream.Position = 0;

                    store.DatabaseCommands.GlobalAdmin.EnsureDatabaseExists("Northwind");

                    await smuggler.ImportData(new SmugglerImportOptions<RavenConnectionStringOptions>
                    {
                        FromStream = stream,
                        To = new RavenConnectionStringOptions
                        {
                            DefaultDatabase = "Northwind",
                            Url = store.Url
                        }
                    });
                }
            }
        }
开发者ID:j2jensen,项目名称:ravendb,代码行数:36,代码来源:RavenDB_3917.cs

示例10: SmugglerBehaviorWhenServerIsDown

        public async Task SmugglerBehaviorWhenServerIsDown()
        {
            var path = Path.GetTempFileName();

            try
            {
                var connectionStringOptions = new RavenConnectionStringOptions { Url = "http://localhost:8078/", DefaultDatabase = "DoesNotExist" };
                var smuggler = new SmugglerDatabaseApi();

                var e = await AssertAsync.Throws<SmugglerException>(() => smuggler.ImportData(
                    new SmugglerImportOptions<RavenConnectionStringOptions>
                    {
                        FromFile = path,
                        To = connectionStringOptions
                    }));

                Assert.Contains("Smuggler encountered a connection problem:", e.Message);

                e = await AssertAsync.Throws<SmugglerException>(() => smuggler.ExportData(
                    new SmugglerExportOptions<RavenConnectionStringOptions>
                    {
                        ToFile = path,
                        From = connectionStringOptions
                    }));

                Assert.Contains("Smuggler encountered a connection problem:", e.Message);
            }
            finally
            {
                IOExtensions.DeleteFile(path);
            }
        }
开发者ID:JackWangCUMT,项目名称:ravendb,代码行数:32,代码来源:SmugglerExecutionTests.cs

示例11: CanPerformDump_Smuggler

        public async Task CanPerformDump_Smuggler()
        {
            var backupPath = NewDataPath("BackupFolder");
            try
            {
                using (var store = NewRemoteDocumentStore())
                {
                    InsertUsers(store, 0, 2000);

                    var dumper = new SmugglerDatabaseApi { Options = { Incremental = true } };
                    await dumper.ExportData(
                        new SmugglerExportOptions<RavenConnectionStringOptions>
                        {
                            ToFile = backupPath,
                            From = new RavenConnectionStringOptions
                            {
                                Url = "http://localhost:8079",
                                DefaultDatabase = store.DefaultDatabase,
                            }
                        });
                }

                VerifyDump(backupPath, store =>
                {
                    using (var session = store.OpenSession())
                    {
                        Assert.Equal(2000, session.Query<User>().Customize(x => x.WaitForNonStaleResultsAsOfNow()).Count());
                    }
                });
            }
            finally
            {
                IOExtensions.DeleteDirectory(backupPath);
            }            
        }
开发者ID:j2jensen,项目名称:ravendb,代码行数:35,代码来源:RavenDB_1603.cs

示例12: CanHandleAttachmentExceptionsGracefully_Smuggler

        public async Task CanHandleAttachmentExceptionsGracefully_Smuggler()
        {
            var backupPath = NewDataPath("BackupFolder");
            var server = GetNewServer();

            int allowDownload = 0;

            var port = 8070;
            var forwarder = new ProxyServer(ref port, 8079)
            {
                VetoTransfer = (totalRead, buffer) =>
                {
                    var payload = System.Text.Encoding.UTF8.GetString(buffer.Array, buffer.Offset, buffer.Count);
                    return payload.Contains("GET /static/users/678 ") && Thread.VolatileRead(ref allowDownload) == 0;
                }
            };
            try
            {
                string databaseName;
                using (var store = new DocumentStore
                {
                    Url = "http://localhost:8079"
                })
                {
                    databaseName = store.DefaultDatabase;
                    store.Initialize();
                    InsertAttachments(store, 2000);
                }

                var dumper = new SmugglerDatabaseApi { Options = { Limit = 1500, Incremental = true } };

                var allAttachments = new List<RavenJObject>();

                OperationState exportResult = null;
                try
                {
                    exportResult = dumper.ExportData(new SmugglerExportOptions<RavenConnectionStringOptions>
                    {
                        ToFile = backupPath,
                        From = new RavenConnectionStringOptions
                        {
                            Url = "http://localhost:" + port,
                            DefaultDatabase = databaseName,
                        }
                    }).Result;
                    Assert.False(true, "Previous op should throw.");
                }
                catch (AggregateException e)
                {
                    var extractSingleInnerException = e.ExtractSingleInnerException() as SmugglerExportException;
                    if (extractSingleInnerException == null)
                        throw;
                    var inner = extractSingleInnerException;
                    exportResult = new OperationState
                    {
                        FilePath = inner.File
                    };
                }
                Interlocked.Increment(ref allowDownload);

                using (var fileStream = new FileStream(exportResult.FilePath, FileMode.Open))
                using (var stream = new GZipStream(fileStream, CompressionMode.Decompress))
                {
                    var chunk1 = RavenJToken.TryLoad(stream) as RavenJObject;
                    var att1 = chunk1["Attachments"] as RavenJArray;
                    allAttachments.AddRange(att1.Values<RavenJObject>());
                }

                exportResult = await dumper.ExportData(new SmugglerExportOptions<RavenConnectionStringOptions>
                {
                    ToFile = backupPath,
                    From = new RavenConnectionStringOptions
                    {
                        Url = "http://localhost:8070",
                        DefaultDatabase = databaseName,
                    }
                });
                using (var fileStream = new FileStream(exportResult.FilePath, FileMode.Open))
                using (var stream = new GZipStream(fileStream, CompressionMode.Decompress))
                {
                    var chunk2 = RavenJToken.TryLoad(stream) as RavenJObject;
                    var attr2 = chunk2["Attachments"] as RavenJArray;
                    allAttachments.AddRange(attr2.Values<RavenJObject>());
                }

                Assert.Equal(2000, allAttachments.Count());
            }
            finally
            {
                IOExtensions.DeleteDirectory(backupPath);
                forwarder.Dispose();
                server.Dispose();
            }
        }
开发者ID:j2jensen,项目名称:ravendb,代码行数:94,代码来源:RavenDB_1603.cs

示例13: CanHandleDocumentExceptionsGracefully_Smuggler

        public async Task CanHandleDocumentExceptionsGracefully_Smuggler()
        {
            var backupPath = NewDataPath("BackupFolder");
            var server = GetNewServer(databaseName: Constants.SystemDatabase);

            var alreadyReset = false;

            var port = 8070;
            var forwarder = new ProxyServer(ref port, 8079)
            {
                VetoTransfer = (totalRead, buffer) =>
                {
                    if (alreadyReset == false && totalRead > 25000)
                    {
                        alreadyReset = true;
                        return true;
                    }
                    return false;
                }
            };
            try
            {
                string databaseName;
                using (var store = new DocumentStore
                {
                    Url = "http://localhost:8079"

                })
                {
                    databaseName = store.DefaultDatabase;
                    store.Initialize();
                    InsertUsers(store, 0, 2000);
                }

                var dumper = new SmugglerDatabaseApi { Options = { Limit = 1900, Incremental = true } };
                
                var allDocs = new List<RavenJObject>();

                OperationState exportResult = null;

                try
                {
                    exportResult = await dumper.ExportData(new SmugglerExportOptions<RavenConnectionStringOptions>
                    {
                        ToFile = backupPath,
                        From = new RavenConnectionStringOptions
                        {
                            Url = "http://localhost:" + port,
                            DefaultDatabase = databaseName,
                        }
                    });
                    Assert.False(true, "Previous op should throw.");
                }
                catch (SmugglerExportException e)
                {
                    exportResult = new OperationState
                    {
                        FilePath = e.File
                    };
                }

                using (var fileSteam = new FileStream(exportResult.FilePath, FileMode.Open))
                using (var stream = new GZipStream(fileSteam, CompressionMode.Decompress))
                {
                    var chunk1 = RavenJToken.TryLoad(stream) as RavenJObject;
                    var doc1 = chunk1["Docs"] as RavenJArray;
                    allDocs.AddRange(doc1.Values<RavenJObject>());
                }

                exportResult = await dumper.ExportData(new SmugglerExportOptions<RavenConnectionStringOptions>
                {
                    ToFile = backupPath,
                    From = new RavenConnectionStringOptions
                    {
                        Url = "http://localhost:8070",
                        DefaultDatabase = databaseName,
                    }
                });
                using (var fileStream = new FileStream(exportResult.FilePath, FileMode.Open))
                using (var stream = new GZipStream(fileStream, CompressionMode.Decompress))
                {
                    var chunk2 = RavenJToken.TryLoad(stream) as RavenJObject;
                    var doc2 = chunk2["Docs"] as RavenJArray;
                    allDocs.AddRange(doc2.Values<RavenJObject>());
                }

                Assert.Equal(2000, allDocs.Count(d => (d.Value<string>("Name") ?? String.Empty).StartsWith("User")));

            }
            finally
            {
                forwarder.Dispose();
                server.Dispose();
                IOExtensions.DeleteDirectory(backupPath);
            }
        }
开发者ID:j2jensen,项目名称:ravendb,代码行数:96,代码来源:RavenDB_1603.cs

示例14: CanDumpAttachmentsEmpty_Smuggler

        public async Task CanDumpAttachmentsEmpty_Smuggler()
        {
            var backupPath = NewDataPath("BackupFolder");
            try
            {
                using (var store = NewRemoteDocumentStore())
                {
                    var dumper = new SmugglerDatabaseApi { Options = { Incremental = true, BatchSize = 100, Limit = 206 } };
                    await dumper.ExportData(
                        new SmugglerExportOptions<RavenConnectionStringOptions>
                        {
                            ToFile = backupPath,
                            From = new RavenConnectionStringOptions
                            {
                                Url = "http://localhost:8079",
                                DefaultDatabase = store.DefaultDatabase,
                            }
                        });
                }

                VerifyDump(backupPath, store => Assert.Equal(0, store.DatabaseCommands.GetAttachmentHeadersStartingWith("user", 0, 500).Count()));
            }
            finally
            {
                IOExtensions.DeleteDirectory(backupPath);
            }            
        }
开发者ID:j2jensen,项目名称:ravendb,代码行数:27,代码来源:RavenDB_1603.cs

示例15: CanDumpWhenHiddenDocsWithLimit_Smuggler

        public async Task CanDumpWhenHiddenDocsWithLimit_Smuggler()
        {
            var backupPath = NewDataPath("BackupFolder");
            try
            {
                using (GetNewServer())
                {
                    using (var store = new DocumentStore { Url = "http://localhost:8079" })
                    {
                        store.Initialize();

                        InsertHidenUsers(store, 2000);

                        var user1 = store.DatabaseCommands.Get("users/1");
                        Assert.Null(user1);

                        InsertUsers(store, 1, 25);

                        // now perform full backup
                        var dumper = new SmugglerDatabaseApi { Options = { Incremental = true } };
                        await dumper.ExportData(
                            new SmugglerExportOptions<RavenConnectionStringOptions>
                            {
                                ToFile = backupPath,
                                From = new RavenConnectionStringOptions
                                {
                                    Url = "http://localhost:8079",
                                    DefaultDatabase = store.DefaultDatabase,
                                }
                            });
                    }
                }

                VerifyDump(backupPath, store =>
                {
                    using (var session = store.OpenSession())
                    {
                        Assert.Equal(25, session.Query<User>().Customize(x => x.WaitForNonStaleResultsAsOfNow()).Count());
                    }
                });
            }
            finally
            {
                IOExtensions.DeleteDirectory(backupPath);
            }            
        }
开发者ID:j2jensen,项目名称:ravendb,代码行数:46,代码来源:RavenDB_1603.cs


注:本文中的Raven.Smuggler.SmugglerDatabaseApi.ExportData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。