-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LiteDB In Memory Database #142
Comments
Hi, I've never thought of this use case before. It sounds interesting and I will have a look at it tomorrow. Maybe it's not that hard to extend the configuration, to run LiteDB in-memory. |
Hi, I've added a very simple LiteDB in-memory configuration. See this Pull Request. I will add the following features in the coming days:
@chrisbewz What features do you need when running LiteDB in-memory? |
While checking some parts of LiteDB source code related to database instantiation, I've noticed that they already have some string patterns on connection string ( // source: LiteDB/Engine/EngineSettings.cs
internal IStreamFactory CreateDataFactory(bool useAesStream = true)
{
if (DataStream != null)
{
return new StreamFactory(DataStream, Password);
}
if (Filename == ":memory:")
{
return new StreamFactory(new MemoryStream(), Password);
}
if (Filename == ":temp:")
{
return new StreamFactory(new TempStream(null, 10485760L), Password);
}
if (!string.IsNullOrEmpty(Filename))
{
return new FileStreamFactory(Filename, Password, ReadOnly, hidden: false, useAesStream);
}
throw new ArgumentException("EngineSettings must have Filename or DataStream as data source");
} Correct me if I'm wrong but maybe the PR changes could be far more simple like just removing the But it still would be nice to have the option to pass a stream directly to support cases like .db files embedded as resources for example (As this usually happens on desktop apps when deploying apps with embedded databases that not necessarly are ment to be copied to end user machine). |
Thanks for the research. I am planning to support both approaches. I hope I have something to look at by the end of this week. |
Hi, recently I was trying to use this framework in some of my applications and came up with a question about lite db database provider and context classes.
I know that LiteDB supports the usage of streams to run as a in-mem database. But while attempting to setup this using this framework I noticed the options class for lite db repository only has a single parameter
DatabaseName
available to specify the path for .db file to use.Also checked that DatabaseProvider uses this to open or creating an empty database on disk, i thought that overriding the logic on DatabaseProvider would solve this but the class is sealed. So how I'm supposed to do enable usage of memory streams w/ LiteDb?
The text was updated successfully, but these errors were encountered: