Raven.Client.Embedded.EmbeddableDocumentStore.SetStudioConfigToAllowSingleDb C# (CSharp) Method

SetStudioConfigToAllowSingleDb() public method

Let the studio knows that it shouldn't display the warning about sys db access
public SetStudioConfigToAllowSingleDb ( ) : void
return void
		public void SetStudioConfigToAllowSingleDb()
		{
			if (DocumentDatabase == null)
				return;
			var jsonDocument = DocumentDatabase.Get("Raven/StudioConfig", null);
			RavenJObject doc;
			RavenJObject metadata;
			if(jsonDocument == null)
			{
				doc = new RavenJObject();
				metadata = new RavenJObject();
			}
			else
			{
				doc = jsonDocument.DataAsJson;
				metadata = jsonDocument.Metadata;
			}

			doc["WarnWhenUsingSystemDatabase"] = false;

			DocumentDatabase.Put("Raven/StudioConfig", null, doc, metadata, null);
		}

Usage Example

        public static void WaitForUserToContinueTheTest(EmbeddableDocumentStore documentStore, bool debug = true)
        {
            if (debug && Debugger.IsAttached == false)
                return;

            documentStore.SetStudioConfigToAllowSingleDb();

            documentStore.DatabaseCommands.Put("Pls Delete Me", null,

                                               RavenJObject.FromObject(new { StackTrace = new StackTrace(true) }),
                                               new RavenJObject());

            documentStore.Configuration.AnonymousUserAccessMode = AnonymousUserAccessMode.Admin;
            using (var server = new HttpServer(documentStore.Configuration, documentStore.DocumentDatabase))
            {
                server.StartListening();
                Process.Start(documentStore.Configuration.ServerUrl); // start the server

                do
                {
                    Thread.Sleep(100);
                } while (documentStore.DatabaseCommands.Get("Pls Delete Me") != null && (debug == false || Debugger.IsAttached));
            }
        }
All Usage Examples Of Raven.Client.Embedded.EmbeddableDocumentStore::SetStudioConfigToAllowSingleDb