问题描述
我能够成功运行的基础上找到的代码RavenDB一个简单的测试:
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
设置:
目标框架的的.NET Framework 4 的
我添加了下面引用到我的项目:
I added the following References to my project:
- \RavenDB - 建设 - 309\EmbeddedClient\Raven.Client。 Embedded.dll
- \RavenDB - 建设 - 309\Client\Raven.Client.Lightweight.dll
- \RavenDB - 建设 - 309\EmbeddedClient\Raven.Storage.Esent.dll
- \RavenDB - 建设 - 309\EmbeddedClient\Raven.Storage.Managed.dll
- \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 have tried searching for this for a few days and tried a few different variations too. I am not sure what's going on.
推荐答案
感谢Ayende Rahien上groups.google.com/group/ravendb/topics。
Thanks to Ayende Rahien on groups.google.com/group/ravendb/topics.
解决的办法是增加Raven.Storage.Esent参照主体工程。这是与Visual Studio和间接引用的问题。
The solution was to add "Raven.Storage.Esent" reference to the main project. It's an issue with Visual Studio and indirect references.
感谢@Derek的暗示我张贴在那里。
Thanks @Derek for suggesting that I post there.
- Pranav
-- Pranav
这篇关于"找不到事务性存储类型"错误使用嵌入RavenDB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!