json - 使用 RunInMemory 查看 RavenDB 中的原始 JSON

标签 json ravendb

我使用 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/

相关文章:

javascript 从解析的对象中调用 Json Parse

php - 为什么使用 json_encode PHP 时 php 的结果与 Mysql 的结果不同?

ios - JSONKit : create a json formatted string

php - 在 ajax 响应文本中发送 json 字符串和 html 数据 - 如何?

ravendb - 从 RavenDB 中提取 Json 属性

c# - RavenDB 查询不返回所有记录

c# - RavenDB 是否在内部优化了 "get document by id"类型的查询?

iphone - MonoTouch - System.Reflection.Emit.ModuleBuilder 错误

c# - 使用 Ravendb 批量删除

ravendb - 实现对多个客户端进行乐观并发检查的事件存储