我使用 RavenDB 和 RunInMemory = true
进行集成测试。我正在调试的问题之一与 JSON 序列化有关。查看内存中的序列化 JSON 数据(作为字符串)的最简单方法是什么 DocumentStore
?
最佳答案
你可以这样做:
static public void WaitForUserToContinueTheTest(
EmbeddableDocumentStore documentStore)
{
if (Debugger.IsAttached == false)
return;
documentStore.DatabaseCommands.Put("Pls Delete Me", null,
RavenJObject.FromObject(new {
StackTrace = new StackTrace(true)
}), new RavenJObject());
documentStore.Configuration.AnonymousUserAccessMode =
AnonymousUserAccessMode.All;
using (var server = new HttpServer(documentStore.Configuration,
documentStore.DocumentDatabase))
{
server.StartListening();
// start the server
Process.Start(documentStore.Configuration.ServerUrl);
do
{
Thread.Sleep(100);
} while (
documentStore.DatabaseCommands.Get("Pls Delete Me") != null &&
Debugger.IsAttached);
}
}
这将为您打开服务器,并让您看到 RavenDB 内部发生的一切。
关于json - 使用 RunInMemory 查看 RavenDB 中的原始 JSON,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9785696/