"Could not find transactional storage type" error with embedded RavenDB
Asked Answered
T

2

17

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.

Tardif answered 29/3, 2011 at 23:30 Comment(6)
Did you post here? groups.google.com/group/ravendb/topicsPino
No, but I will post there as wellTardif
@Derek I was getting the same error with 288Tardif
I thought with either you still specify just DocumentStore, I'll look at when I can get on a PC.Pino
Just from a distant place in my head, but do you have a config file somewhere stating that the engine of choice is supposed to be Esent? The embeddable one is supposed to be Managed Engine only or am I wrong?Jannery
@Mike Esent is always the default, even with EmbeddedValine
T
17

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

Tardif answered 31/3, 2011 at 12:56 Comment(2)
It seems like a reference to Raven.Storage.Esent must be added to the testproject testing a class that news up a documentstore. I had the same problem when writing my first test to start playing with raven.Unkenned
Anyone know what causes this? Is there a work around so it doesn't need to be added to the other project?Eutherian
K
5

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

Klopstock answered 6/9, 2011 at 10:58 Comment(1)
Thnx, I don't know why it wasn't included the first time, as it was already referenced in the project, but I made a new publish and now everything needed was there.Becalmed

© 2022 - 2024 — McMap. All rights reserved.