“找不到事务存储类型”嵌入式 RavenDB 错误
我能够根据以下位置的代码成功运行 RavenDB 的简单测试:http://ravendb。 net/tutorials/hello-world
接下来,我尝试以嵌入式方式运行它,但我不断收到以下错误:
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\raven\Raven.Database\Config\InMemoryRavenConfiguration.cs:line 272
at Raven.Database.DocumentDatabase..ctor(InMemoryRavenConfiguration configuration) in c:\Builds\raven\Raven.Database\DocumentDatabase.cs:line 109
at Raven.Client.Client.EmbeddableDocumentStore.InitializeInternal() in c:\Builds\raven\Raven.Client.Embedded\EmbeddableDocumentStore.cs:line 130
at Raven.Client.Document.DocumentStore.Initialize() in c:\Builds\raven\Raven.Client.Lightweight\Document\DocumentStore.cs:line 388
at Tests.RavenEmbedded.RavenDB..ctor() in C:\Users\Pranav\Documents\Projects\Repositories-Clone\Common-clone\Tests\RavenDB.cs:line 114
at Tests.TestRavenDB.Basics() in C:\Users\Pranav\Documents\Projects\Repositories-Clone\Common-clone\Tests\RavenDB.cs:line 170
安装:
目标框架是.NET Framework 4
我添加了以下对我的项目的引用:
- \RavenDB-Build-309\EmbeddedClient\Raven.Client.Embedded.dll
- \RavenDB-Build-309\Client\Raven.Client.Lightweight.dll
- \RavenDB-Build-309\EmbeddedClient\Raven.Storage .Esent.dll
- \RavenDB-Build-309\EmbeddedClient\Raven.Storage.Managed.dll
代码是:
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:\Temp\RavenData" }; //Raven.Storage.Esent.TransactionalStorage var store = new EmbeddableDocumentStore { DataDirectory = @"C:\Temp\RavenData" }; 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 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\raven\Raven.Database\Config\InMemoryRavenConfiguration.cs:line 272
at Raven.Database.DocumentDatabase..ctor(InMemoryRavenConfiguration configuration) in c:\Builds\raven\Raven.Database\DocumentDatabase.cs:line 109
at Raven.Client.Client.EmbeddableDocumentStore.InitializeInternal() in c:\Builds\raven\Raven.Client.Embedded\EmbeddableDocumentStore.cs:line 130
at Raven.Client.Document.DocumentStore.Initialize() in c:\Builds\raven\Raven.Client.Lightweight\Document\DocumentStore.cs:line 388
at Tests.RavenEmbedded.RavenDB..ctor() in C:\Users\Pranav\Documents\Projects\Repositories-Clone\Common-clone\Tests\RavenDB.cs:line 114
at Tests.TestRavenDB.Basics() in C:\Users\Pranav\Documents\Projects\Repositories-Clone\Common-clone\Tests\RavenDB.cs:line 170
Setup:
Target framework is .NET Framework 4
I added the following References to my project:
- \RavenDB-Build-309\EmbeddedClient\Raven.Client.Embedded.dll
- \RavenDB-Build-309\Client\Raven.Client.Lightweight.dll
- \RavenDB-Build-309\EmbeddedClient\Raven.Storage.Esent.dll
- \RavenDB-Build-309\EmbeddedClient\Raven.Storage.Managed.dll
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:\Temp\RavenData" }; //Raven.Storage.Esent.TransactionalStorage var store = new EmbeddableDocumentStore { DataDirectory = @"C:\Temp\RavenData" }; 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
感谢 groups.google.com/group/ravendb/topics 上的 Ayende Rahien。
解决方案是将“Raven.Storage.Esent”引用添加到主项目中。这是 Visual Studio 和间接引用的问题。
感谢@Derek 建议我在那里发帖。
——普拉纳夫
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
您需要添加对 Raven.Storage.Esent.dll 的引用
You need to add a reference to Raven.Storage.Esent.dll