“找不到事务存储类型”嵌入式 RavenDB 错误

发布于 2024-12-03 12:36:09 字数 4034 浏览 0 评论 0原文

我能够根据以下位置的代码成功运行 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

我添加了以下对我的项目的引用:

  1. \RavenDB-Build-309\EmbeddedClient\Raven.Client.Embedded.dll
  2. \RavenDB-Build-309\Client\Raven.Client.Lightweight.dll
  3. \RavenDB-Build-309\EmbeddedClient\Raven.Storage .Esent.dll
  4. \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:

  1. \RavenDB-Build-309\EmbeddedClient\Raven.Client.Embedded.dll
  2. \RavenDB-Build-309\Client\Raven.Client.Lightweight.dll
  3. \RavenDB-Build-309\EmbeddedClient\Raven.Storage.Esent.dll
  4. \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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

汹涌人海 2024-12-10 12:36:09

感谢 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

梦里梦着梦中梦 2024-12-10 12:36:09

您需要添加对 Raven.Storage.Esent.dll 的引用

You need to add a reference to Raven.Storage.Esent.dll

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文