Embedded Document Stores and/or In-Memory Databases

The type EmbeddableDocumentStore is gone. But it does not mean that you have no good options to replace his functionality. The technique I share here can be easily adopted in any language or framework.

Are you ready? So, let’s examine the Raven.TestDriver source code.

private static ProcessStartInfo GetProcessStartInfo(TLocator locator)
{
    if (File.Exists(locator.ServerPath) == false)
    {
        throw new FileNotFoundException("Server file was not found", locator.ServerPath);
    }

    using (var currentProcess = Process.GetCurrentProcess())
    {
        var commandArguments = new List
        {
            locator.CommandArguments,
            "--ServerUrl=http://127.0.0.1:0",
            "--RunInMemory=true",
            "--Testing.ParentProcessId=" + currentProcess.Id,
            "--Setup.Mode=None"
        };

        var argumentsString = string.Join(" ", commandArguments);
        return new ProcessStartInfo
        {
            FileName = locator.Command,
            Arguments = argumentsString,
            CreateNoWindow = true,
            RedirectStandardOutput = true,
            RedirectStandardError = true,
            UseShellExecute = false,
        };
    }
}

Yeap! You got it. Our recommendation now is to start a child process instead of having Raven running on the same process of your application.

As you can see, you can now specify a “Parent Process Id” to the RavenDB Server. So, when the “parent process” is gone, Raven will gently stop as well.

Please, note the “RunInMemory” option. Nice, huh?

Let me know if you have any additional questions about this subjects.

Compartilhe este insight:

Elemar Júnior

Sou fundador e CEO da EximiaCo e atuo como tech trusted advisor ajudando diversas empresas a gerar mais resultados através da tecnologia.

Elemar Júnior

Sou fundador e CEO da EximiaCo e atuo como tech trusted advisor ajudando diversas empresas a gerar mais resultados através da tecnologia.

Mais insights para o seu negócio

Veja mais alguns estudos e reflexões que podem gerar alguns insights para o seu negócio:

Há alguns anos, cheguei, por acaso, a uma palestra do Simon Sinek no TED. Na época, ele ainda era um...
Quando iniciei a EximiaCo, busquei implantar, na empresa, características minhas que valorizava e que achava que poderiam fazer diferença. Sabia,...
In the previous post, I shared some good things about our new query language: RQL. Now, I will show you...
Um dos princípios que mais valorizo em práticas ágeis é o feedback. De todos os tipos de feedback que já...
In this post, I will help you to set up your first RavenDB cluster. To be honest, it is not...
O comportamento que descrevo nesse post é extremamente nocivo a carreira de todo técnico. Geralmente resulta em desgaste desnecessário e...
Oferta de pré-venda!

Mentoria em
Arquitetura de Software

Práticas, padrões & técnicas para Arquitetura de Software, de maneira efetiva, com base em cenários reais para profissionais envolvidos no projeto e implantação de software.

× Precisa de ajuda?