gpt4 book ai didi

unit-testing - RavenDB:获取内存文档存储区 "Voron is prone to failure in 32-bits mode."的异常

转载 作者:行者123 更新时间:2023-12-03 20:41:29 26 4
gpt4 key购买 nike

在遵循 RavenDB 的文档之后

http://ravendb.net/docs/article-page/2.5/csharp/samples/raven-tests/createraventests

我无法成功获得单元测试以运行超过内存文档存储的创建。我使用 RavenDB 的 RavenTestBase 复制并粘贴了上面文档中的测试样本。

[TestClass]
public class IndexTest : RavenTestBase
{
[TestMethod]
public void CanIndexAndQuery()
{
using (var store = NewDocumentStore())
{
new SampleData_Index().Execute(store);

using (var session = store.OpenSession())
{
session.Store(new SampleData
{
Name = "RavenDB"
});

session.SaveChanges();
}

using (var session = store.OpenSession())
{
var result = session.Query<SampleData, SampleData_Index>()
.Customize(customization => customization.WaitForNonStaleResultsAsOfNow())
.FirstOrDefault();

Assert.Equals(result.Name, "RavenDB");
}
}
}
}

public class SampleData
{
public string Name { get; set; }
}

public class SampleData_Index : AbstractIndexCreationTask<SampleData>
{
public SampleData_Index()
{
Map = docs => from doc in docs
select new
{
doc.Name
};
}
}

到达 NewDocumentStore() 后...我收到以下异常:

“用户代码未处理异常
Voron 在 32 位模式下容易失败。使用 Raven/Voron/AllowOn32Bits 在 32 位进程中强制使用 voron。”

我正在使用 Visual Studio 2013(更新 4)和 RavenDB 3.0

谢谢!

最佳答案

在 NewDocumentStore 的构造函数中,传入 configureStore 参数。这是一个以 EmbeddableDocumentStore 作为其参数的 Action。在该操作中,您可以设置配置的不同部分,包括 AllowOn32Bits 属性(property)。

public void ConfigureTestStore(EmbeddableDocumentStore documentStore)
{
documentStore.Configuration.Storage.Voron.AllowOn32Bits = true;
}

然后将此作为构造函数中的 configureStore 参数传递。
using (var store = NewDocumentStore(configureStore:ConfigureTestStore))

关于unit-testing - RavenDB:获取内存文档存储区 "Voron is prone to failure in 32-bits mode."的异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30517583/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com