“Could not find transactional storage type” error with embedded RavenDB

吃可爱长大的小学妹 提交于 2019-12-12 07:26:05

问题


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.


回答1:


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




回答2:


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



来源:https://stackoverflow.com/questions/5480168/could-not-find-transactional-storage-type-error-with-embedded-ravendb

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!