我试图在单元测试项目中使用 Raven.Client.Embedded.EmbeddableDocumentStore
(Build 960),如下所示:
private IDocumentStore CreateDocumentStore()
{
var store = new EmbeddableDocumentStore
{
RunInMemory = true,
Conventions = new DocumentConvention
{
DefaultQueryingConsistency = ConsistencyOptions.QueryYourWrites,
IdentityPartsSeparator = "-"
}
};
store.Initialize();
IndexCreation.CreateIndexes(typeof (RavenIndexes).Assembly, store);
return store;
}
我通过NuGet安装了以下RavenDB组件:
-
RavenDB.Embedded
-
RavenDB.Client
上面的代码失败,因为它无法找到Raven.Database 1.0.0.0程序集 . 为了解决这个问题,我还通过nuget安装了RavenDB.Database包 . 这增加了一堆我不想要的东西,这是预期的,因为这个包的nuget description:
如果要扩展RavenDB,请使用此包 . 如果您只想使用现有的RavenDB服务器,请不要使用此包,以便只使用RavenDB.Client包中的客户端API .
现在,当我尝试使用NuGet卸载RavenDB.Database包时,它告诉我我不能:
卸载程序包:无法卸载“RavenDB.Database 1.0.960”,因为“RavenDB.Embedded 1.0.960”依赖于它 .
那么该怎么办?我是否弄乱了我的NuGet纯度,并从我的单元测试项目中手动删除所有未使用的引用( RavenDB.Smuggler
等),只留下 RavenDB.Database
参考?或者我在某个地方出错?当然 EmbeddableDocumentStore
不需要我安装整个RavenDB.Database包 .
谢谢
1 回答
可嵌入依赖于数据库,因为当您运行Embeddable时,您正在应用程序中运行整个数据库服务器引擎,而数据库包中包含该引擎 .