我能够根据以下位置的代码成功运行 RavenDB 的简单测试:http:///ravendb.net/tutorials/hello-world
接下来我尝试以嵌入式方式运行它,但我不断收到以下错误:
消息:找不到事务存储类型:Raven.Storage.Esent.TransactionalStorage、Raven.Storage.EsentStackTrace:在 c:Builds
avenRaven.DatabaseConfigInMemoryRavenConfiguration.cs:line 272 中的 Raven.Database.Config.InMemoryRavenConfiguration.CreateTransactionalStorage(Action notifyAboutWork)在 c:Builds
avenRaven.DatabaseDocumentDatabase.cs:line 109 中的 Raven.Database.DocumentDatabase..ctor(InMemoryRavenConfiguration 配置)在 c:Builds
avenRaven.Client.EmbeddedEmbeddableDocumentStore.cs:line 130 中的 Raven.Client.Client.EmbeddableDocumentStore.InitializeInternal()在 c:Builds
avenRaven.Client.LightweightDocumentDocumentStore.cs:line 388 中的 Raven.Client.Document.DocumentStore.Initialize()在 C:UsersPranavDocumentsProjectsRepositories-CloneCommon-cloneTestsRavenDB.cs:line 114 中的 Tests.RavenEmbedded.RavenDB..ctor()在 C:UsersPranavDocumentsProjectsRepositories-CloneCommon-cloneTestsRavenDB.cs:line 170 中的 Tests.TestRavenDB.Basics()
<小时>
设置:
目标框架是.NET Framework 4
我在我的项目中添加了以下引用:
<小时>
代码为:
<上一页>命名空间 Tests.RavenEmbedded{使用 Raven.Client.Client;使用 Raven.Client.Document;使用 Raven.Storage.Esent;使用 Raven.Storage.Managed;使用 Tests.RavenData;RavenDB 类{公共 RavenDB(){//EmbeddableDocumentStore store = new EmbeddableDocumentStore { DataDirectory = @"C:TempRavenData" };//Raven.Storage.Esent.TransactionalStoragevar store = new EmbeddableDocumentStore { DataDirectory = @"C:TempRavenData" };商店.初始化();#region 写入数据使用 (var session = store.OpenSession()){var 产品 = 新产品{成本 = 3.99m,名称=牛奶",};session.Store(产品);session.SaveChanges();session.Store(新订单{客户=客户/ayende",订单行 ={新订单行{产品 ID = 产品 ID,数量 = 3},}});session.SaveChanges();}#endregion#region 读取数据使用 (var session = store.OpenSession()){var order = session.Load("orders/1");Debug.Print("客户:{0}", order.Customer);foreach (var orderLine in order.OrderLines){Debug.Print("Product: {0} x {1}", orderLine.ProductId, orderLine.Quantity);}session.SaveChanges();}#endregion}}}命名空间测试{公共类 TestRavenDB{公共静态无效基础(){尝试{//var db = new RavenClientServer.RavenDB();var db = new RavenEmbedded.RavenDB();}捕捉(例外前){Debug.Print("消息:{0}",ex.Message);Debug.Print("StackTrace: {0} ",ex.StackTrace);}}}}我已经尝试搜索了几天,也尝试了一些不同的变体.我不确定发生了什么.
感谢 groups.google.com/group/ravendb/topics 上的 Ayende Rahien.
解决方案是将Raven.Storage.Esent"引用添加到主项目.这是 Visual Studio 和间接引用的问题.
感谢@Derek 建议我在那里发帖.
-- 普拉纳夫
I was able to successfully run a simple test for RavenDB based on the code found at: http://ravendb.net/tutorials/hello-world
Next I tried to run it in an Embedded Manner, but I keep on getting the following error:
Message: Could not find transactional storage type: Raven.Storage.Esent.TransactionalStorage, Raven.Storage.Esent
StackTrace: at Raven.Database.Config.InMemoryRavenConfiguration.CreateTransactionalStorage(Action notifyAboutWork) in c:Builds
avenRaven.DatabaseConfigInMemoryRavenConfiguration.cs:line 272
at Raven.Database.DocumentDatabase..ctor(InMemoryRavenConfiguration configuration) in c:Builds
avenRaven.DatabaseDocumentDatabase.cs:line 109
at Raven.Client.Client.EmbeddableDocumentStore.InitializeInternal() in c:Builds
avenRaven.Client.EmbeddedEmbeddableDocumentStore.cs:line 130
at Raven.Client.Document.DocumentStore.Initialize() in c:Builds
avenRaven.Client.LightweightDocumentDocumentStore.cs:line 388
at Tests.RavenEmbedded.RavenDB..ctor() in C:UsersPranavDocumentsProjectsRepositories-CloneCommon-cloneTestsRavenDB.cs:line 114
at Tests.TestRavenDB.Basics() in C:UsersPranavDocumentsProjectsRepositories-CloneCommon-cloneTestsRavenDB.cs:line 170
Setup:
Target framework is .NET Framework 4
I added the following References to my project:
The code is:
namespace Tests.RavenEmbedded { using Raven.Client.Client; using Raven.Client.Document; using Raven.Storage.Esent; using Raven.Storage.Managed; using Tests.RavenData; class RavenDB { public RavenDB() { // EmbeddableDocumentStore store = new EmbeddableDocumentStore { DataDirectory = @"C:TempRavenData" }; //Raven.Storage.Esent.TransactionalStorage var store = new EmbeddableDocumentStore { DataDirectory = @"C:TempRavenData" }; store.Initialize(); #region Write Data using (var session = store.OpenSession()) { var product = new Product { Cost = 3.99m, Name = "Milk", }; session.Store(product); session.SaveChanges(); session.Store(new Order { Customer = "customers/ayende", OrderLines = { new OrderLine { ProductId = product.Id, Quantity = 3 }, } }); session.SaveChanges(); } #endregion #region Read Data using (var session = store.OpenSession()) { var order = session.Load("orders/1"); Debug.Print("Customer: {0}", order.Customer); foreach (var orderLine in order.OrderLines) { Debug.Print("Product: {0} x {1}", orderLine.ProductId, orderLine.Quantity); } session.SaveChanges(); } #endregion } } } namespace Tests { public class TestRavenDB { public static void Basics() { try { //var db = new RavenClientServer.RavenDB(); var db = new RavenEmbedded.RavenDB(); } catch (Exception ex) { Debug.Print("Message: {0} ",ex.Message); Debug.Print("StackTrace: {0} ",ex.StackTrace); } } } }
I have tried searching for this for a few days and tried a few different variations too. I am not sure what's going on.
Thanks to Ayende Rahien on groups.google.com/group/ravendb/topics.
The solution was to add "Raven.Storage.Esent" reference to the main project. It's an issue with Visual Studio and indirect references.
Thanks @Derek for suggesting that I post there.
-- Pranav
这篇关于“找不到事务存储类型"嵌入式 RavenDB 出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!