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


C# Config.RavenConfiguration类代码示例

本文整理汇总了C#中Raven.Database.Config.RavenConfiguration的典型用法代码示例。如果您正苦于以下问题:C# RavenConfiguration类的具体用法?C# RavenConfiguration怎么用?C# RavenConfiguration使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: GetNewServer

        protected RavenDbServer GetNewServer()
        {
        	var ravenConfiguration = new RavenConfiguration
        	{
        		Port = 8080,
        		RunInMemory = true,
        		DataDirectory = "Data",
        		AnonymousUserAccessMode = AnonymousUserAccessMode.All
        	};

        	ConfigureServer(ravenConfiguration);

			if(ravenConfiguration.RunInMemory == false)
				IOExtensions.DeleteDirectory(ravenConfiguration.DataDirectory);

        	var ravenDbServer = new RavenDbServer(ravenConfiguration);

			using (var documentStore = new DocumentStore
			{
				Url = "http://localhost:8080"
			}.Initialize())
			{
				new RavenDocumentsByEntityName().Execute(documentStore);
			}

        	return ravenDbServer;
        }
开发者ID:wbinford,项目名称:ravendb,代码行数:27,代码来源:RemoteClientTest.cs

示例2: EsentExportOperation

 public EsentExportOperation(string dataDirPath)
 {
     var dbFullPath = Path.Combine(dataDirPath, "Data");            
     try
     {
         Api.JetCreateInstance(out instance, "instance");
         var ravenConfiguration = new RavenConfiguration();
         ravenConfiguration.DataDirectory = dataDirPath;
         ravenConfiguration.Storage.PreventSchemaUpdate = true;
         ITransactionalStorage storage;
         var success = StorageExporter.TryToCreateTransactionalStorage(ravenConfiguration, out storage);
         if (!success) ConsoleUtils.PrintErrorAndFail("Failed to create transactional storage");
         var configurator = new TransactionalStorageConfigurator(ravenConfiguration, (TransactionalStorage)storage);
         configurator.ConfigureInstance(instance, dataDirPath);
         storage.Dispose();
         Api.JetInit(ref instance);
         Api.JetBeginSession(instance, out sesid, null, null);           
         Api.JetAttachDatabase(sesid, dbFullPath, AttachDatabaseGrbit.None);
         Api.JetOpenDatabase(sesid, dbFullPath, null, out dbid, OpenDatabaseGrbit.None);
     }
     catch (Exception e)
     {
         ConsoleUtils.PrintErrorAndFail(e.Message, e.StackTrace);
     }
 }
开发者ID:j2jensen,项目名称:ravendb,代码行数:25,代码来源:EsentExportOperation.cs

示例3: RespondToAdmin

		public override void RespondToAdmin(IHttpContext context)
		{
			if (EnsureSystemDatabase(context) == false)
				return;

			var restoreRequest = context.ReadJsonObject<RestoreRequest>();

			var ravenConfiguration = new RavenConfiguration();
			if (File.Exists(Path.Combine(restoreRequest.RestoreLocation, "Raven.ravendb")))
			{
				ravenConfiguration.DefaultStorageTypeName = "Raven.Storage.Managed.TransactionalStorage, Raven.Storage.Managed";
			}
			else if (Directory.Exists(Path.Combine(restoreRequest.RestoreLocation, "new")))
			{
				ravenConfiguration.DefaultStorageTypeName = "Raven.Storage.Esent.TransactionalStorage, Raven.Storage.Esent";
			}
			var restoreDoc = new List<string>();

			// Commented out unfinished code to get it to compile
			//		    DocumentDatabase.Restore(ravenConfiguration, restoreRequest.RestoreLocation, restoreRequest.DatabaseLocation,
			//		                             msg =>
			//		                             {
			//
			//		                             });
			//            SystemDatabase.
		}
开发者ID:denno-secqtinstien,项目名称:ravendb,代码行数:26,代码来源:AdminRestore.cs

示例4: Restore

        public static void Restore(RavenConfiguration configuration, DatabaseRestoreRequest restoreRequest, Action<string> output)
        {
            var databaseDocumentPath = FindDatabaseDocument(restoreRequest.BackupLocation);
            if (File.Exists(databaseDocumentPath) == false)
            {
                throw new InvalidOperationException("Cannot restore when the Database.Document file is missing in the backup folder: " + restoreRequest.BackupLocation);
            }

            var databaseDocumentText = File.ReadAllText(databaseDocumentPath);
            var databaseDocument = RavenJObject.Parse(databaseDocumentText).JsonDeserialization<DatabaseDocument>();

            string storage;
            if (databaseDocument.Settings.TryGetValue("Raven/StorageTypeName", out storage) == false)
            {
                storage = "esent";
            }

            if (!string.IsNullOrWhiteSpace(restoreRequest.DatabaseLocation))
            {
                configuration.DataDirectory = restoreRequest.DatabaseLocation;
            }

            using (var transactionalStorage = configuration.CreateTransactionalStorage(storage, () => { }))
            {
                transactionalStorage.Restore(restoreRequest, output);
            }
        }
开发者ID:kijanawoodard,项目名称:ravendb,代码行数:27,代码来源:MaintenanceActions.cs

示例5: StorageExporter

 public StorageExporter(string databaseBaseDirectory, string databaseOutputFile,int batchSize)
 {
     baseDirectory = databaseBaseDirectory;
     outputDirectory = databaseOutputFile;
     var ravenConfiguration = new RavenConfiguration();
     ravenConfiguration.DataDirectory = databaseBaseDirectory;
     ravenConfiguration.Storage.PreventSchemaUpdate = true;
     CreateTransactionalStorage(ravenConfiguration);
     BatchSize = batchSize;
 }
开发者ID:GorelH,项目名称:ravendb,代码行数:10,代码来源:StorageExporter.cs

示例6: StorageExporter

 public StorageExporter(string databaseBaseDirectory, string databaseOutputFile,int batchSize,Etag documentsStartEtag)
 {
     baseDirectory = databaseBaseDirectory;
     outputDirectory = databaseOutputFile;
     var ravenConfiguration = new RavenConfiguration();
     ravenConfiguration.DataDirectory = databaseBaseDirectory;
     ravenConfiguration.Storage.PreventSchemaUpdate = true;
     ravenConfiguration.Storage.SkipConsistencyCheck = true;
     CreateTransactionalStorage(ravenConfiguration);
     BatchSize = batchSize;
     DocumentsStartEtag = documentsStartEtag;
 }
开发者ID:j2jensen,项目名称:ravendb,代码行数:12,代码来源:StorageExporter.cs

示例7: TestServerFixture

		public TestServerFixture()
		{
			var configuration = new RavenConfiguration();
			configuration.Port = Port;
			configuration.ServerName = ServerName;
			configuration.RunInMemory = configuration.DefaultStorageTypeName == InMemoryRavenConfiguration.VoronTypeName;
			configuration.DataDirectory = Path.Combine(configuration.DataDirectory, "Tests");

			IOExtensions.DeleteDirectory(configuration.DataDirectory);

			Server = new RavenDbServer(configuration)
			{
				UseEmbeddedHttpServer = true
			}.Initialize();
		}
开发者ID:cocytus,项目名称:ravendb,代码行数:15,代码来源:TestServerFixture.cs

示例8: ConvertToRavenConfiguration

		public RavenConfiguration ConvertToRavenConfiguration()
		{
			var configuration = new RavenConfiguration
			                    {
				                    Port = Port,
				                    RunInMemory = RunInMemory,
				                    DefaultStorageTypeName = "esent"
			                    };

			foreach (var key in Settings.Keys)
			{
				configuration.Settings.Add(key, Settings[key]);
			}

			return configuration;
		}
开发者ID:ReginaBricker,项目名称:ravendb,代码行数:16,代码来源:ServerConfiguration.cs

示例9: RespondToAdmin

		public override void RespondToAdmin(IHttpContext context)
		{
			if (EnsureSystemDatabase(context) == false)
				return;

			var restoreRequest = context.ReadJsonObject<RestoreRequest>();

			var ravenConfiguration = new RavenConfiguration();
			if (File.Exists(Path.Combine(restoreRequest.RestoreLocation, "Raven.ravendb")))
			{
				ravenConfiguration.DefaultStorageTypeName = "Raven.Storage.Managed.TransactionalStorage, Raven.Storage.Managed";
			}
			else if (Directory.Exists(Path.Combine(restoreRequest.RestoreLocation, "new")))
			{
				ravenConfiguration.DefaultStorageTypeName = "Raven.Storage.Esent.TransactionalStorage, Raven.Storage.Esent";
			}

			var restoreStatus = new List<string>();

			DocumentDatabase.Restore(ravenConfiguration, restoreRequest.RestoreLocation, restoreRequest.DatabaseLocation,
			                         msg =>
			                         {
				                         restoreStatus.Add(msg);
				                         SystemDatabase.Put(RestoreStatus.RavenRestoreStatusDocumentKey, null,
											 RavenJObject.FromObject(new {restoreStatus}), new RavenJObject(), null);
			                         });

			if (File.Exists(Path.Combine(restoreRequest.RestoreLocation, "Database.Document")))
			{
				var databaseDocumentText = File.ReadAllText(Path.Combine(restoreRequest.RestoreLocation, "Database.Document"));
				var databaseDocument = RavenJObject.Parse(databaseDocumentText).JsonDeserialization<DatabaseDocument>();
				if (databaseDocument == null)
					return;

				if (!string.IsNullOrWhiteSpace(restoreRequest.DatabaseLocation))
					databaseDocument.Settings[Constants.RavenDataDir] = restoreRequest.DatabaseLocation;
				if (!string.IsNullOrWhiteSpace(restoreRequest.DatabaseName))
					databaseDocument.Id = "Raven/Databases/" + restoreRequest.DatabaseName;
				SystemDatabase.Put(databaseDocument.Id, null, RavenJObject.FromObject(databaseDocument), new RavenJObject(), null);

				restoreStatus.Add("The new database was created");
				SystemDatabase.Put(RestoreStatus.RavenRestoreStatusDocumentKey, null,
					RavenJObject.FromObject(new { restoreStatus }), new RavenJObject(), null);
			}
		}
开发者ID:remcoros,项目名称:ravendb,代码行数:45,代码来源:AdminRestore.cs

示例10: GetNewServer

		protected RavenDbServer GetNewServer(int port)
		{
			var dataDirectory = Path.Combine(NewDataPath(), "System");
			var configuration = new RavenConfiguration
								{
									Port = port,
									DataDirectory = dataDirectory,
									AnonymousUserAccessMode = AnonymousUserAccessMode.Admin
								};
			configuration.RunInMemory = configuration.DefaultStorageTypeName == InMemoryRavenConfiguration.VoronTypeName;

			var ravenDbServer = new RavenDbServer(configuration)
			{
				UseEmbeddedHttpServer = true
			};

			ravenDbServer.Initialize();
			return ravenDbServer;
		}
开发者ID:GorelH,项目名称:ravendb,代码行数:19,代码来源:Basic.cs

示例11: TestServerFixture

		public TestServerFixture()
		{
			var configuration = new RavenConfiguration();
			configuration.Port = Port;
			configuration.ServerName = ServerName;
			configuration.RunInMemory = configuration.DefaultStorageTypeName == InMemoryRavenConfiguration.VoronTypeName;
			configuration.DataDirectory = Path.Combine(configuration.DataDirectory, "Tests");
			configuration.MaxSecondsForTaskToWaitForDatabaseToLoad = 10;

			IOExtensions.DeleteDirectory(configuration.DataDirectory);

			NonAdminHttp.EnsureCanListenToWhenInNonAdminContext(Port);

			Server = new RavenDbServer(configuration)
			{
				UseEmbeddedHttpServer = true,
				RunInMemory = true
			}.Initialize();
		}
开发者ID:jrusbatch,项目名称:ravendb,代码行数:19,代码来源:TestServerFixture.cs

示例12: StorageExporter

 public StorageExporter(string databaseBaseDirectory, string databaseOutputFile, 
     int batchSize, Etag documentsStartEtag, bool hasCompression, EncryptionConfiguration encryption)
 {
     HasCompression = hasCompression;
     Encryption = encryption;
     baseDirectory = databaseBaseDirectory;
     outputDirectory = databaseOutputFile;
     var ravenConfiguration = new RavenConfiguration
     {
         DataDirectory = databaseBaseDirectory,
         CacheDocumentsInMemory = false,
         Storage =
         {
             PreventSchemaUpdate = true,
             SkipConsistencyCheck = true,
         }
     };
     CreateTransactionalStorage(ravenConfiguration);
     this.batchSize = batchSize;
     DocumentsStartEtag = documentsStartEtag;
 }
开发者ID:IdanHaim,项目名称:ravendb,代码行数:21,代码来源:StorageExporter.cs

示例13: RavenDB_1594

		public RavenDB_1594()
		{
		    path = NewDataPath();
			Raven.Database.Extensions.IOExtensions.DeleteDirectory(path);
			var config = new Raven.Database.Config.RavenConfiguration
			             	{
			             		Port = 8079,
			             		RunInUnreliableYetFastModeThatIsNotSuitableForProduction = true,
			             		DataDirectory = path,
								Settings = { { "Raven/ActiveBundles", "PeriodicBackup" } },
			             	};
			config.PostInit();
		    ravenDbServer = new RavenDbServer(config)
		    {
		        UseEmbeddedHttpServer = true
		    };
		    ravenDbServer.Initialize();
			documentStore = new DocumentStore
			{
				Url = "http://localhost:8079"
			};
			documentStore.Initialize();
		}
开发者ID:randacc,项目名称:ravendb,代码行数:23,代码来源:RavenDB_1594.cs

示例14: ModifyConfiguration

		protected virtual void ModifyConfiguration(RavenConfiguration configuration)
		{
		}
开发者ID:nicolasgarfinkiel,项目名称:ravendb,代码行数:3,代码来源:RavenTest.cs

示例15: GetNewServer

		protected RavenDbServer GetNewServer(int port = 8079, string dataDirectory = "Data")
		{
			var ravenConfiguration = new RavenConfiguration
									 {
										 Port = port,
										 DataDirectory = dataDirectory,
										 RunInMemory = true,
										 AnonymousUserAccessMode = AnonymousUserAccessMode.All
									 };

			ModifyConfiguration(ravenConfiguration);

			if (ravenConfiguration.RunInMemory == false)
				IOExtensions.DeleteDirectory(ravenConfiguration.DataDirectory);

			NonAdminHttp.EnsureCanListenToWhenInNonAdminContext(ravenConfiguration.Port);
			var ravenDbServer = new RavenDbServer(ravenConfiguration);

			try
			{
				using (var documentStore = new DocumentStore
											{
												Conventions =
													{
														FailoverBehavior = FailoverBehavior.FailImmediately
													},
												Url = "http://localhost:" + port
											}.Initialize())
				{
					CreateDefaultIndexes(documentStore);
				}
			}
			catch
			{
				ravenDbServer.Dispose();
				throw;
			}
			return ravenDbServer;
		}
开发者ID:rguerreiro,项目名称:ravendb,代码行数:39,代码来源:RavenTest.cs


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