Custom_In-Memory_Database
2.0.0
dotnet add package Custom_In-Memory_Database --version 2.0.0
NuGet\Install-Package Custom_In-Memory_Database -Version 2.0.0
<PackageReference Include="Custom_In-Memory_Database" Version="2.0.0" />
<PackageVersion Include="Custom_In-Memory_Database" Version="2.0.0" />
<PackageReference Include="Custom_In-Memory_Database" />
paket add Custom_In-Memory_Database --version 2.0.0
#r "nuget: Custom_In-Memory_Database, 2.0.0"
#:package Custom_In-Memory_Database@2.0.0
#addin nuget:?package=Custom_In-Memory_Database&version=2.0.0
#tool nuget:?package=Custom_In-Memory_Database&version=2.0.0
Custom In-Memory Database
About
This is a light-weight, in-memory database built as part of a research project at Cal Poly Pomona. It can especially be useful for testing purposes where you want isolated databases with ease of set up, and simulate real database functions.
Basic functionalities include all CRUD operations and aims to follow ACID architecture as closely as possible, inspired by PostgreSQL's implementations. It supports concurrency using Multi-Version Control Concurrency and async read write locks to simulate Read Commited isolation level. It can also perform type-checks, and save to disk on crash by default, and create a B-tree indexing to speed up query search.
Installation
On the command line interface:
dotnet add package Custom_In-Memory_Database
How to Setup
1. Dependency Injection
You can register the in-memory database service in your application by passing your service collection like this. DatabaseServiceRegistrar.AddInMemoryDBService(IServiceCollection service);
By default, it will register the necessary dependecies, FileManager and SearchManager, and the main Database class.
or
You can implement your own custom IFileManager and ISearchManager and either pass it along as parameters as below. Or if an instance is already registered in the DI container, it will be used.
DatabaseServiceRegistrar.AddInMemoryDBService(IServiceCollection services,ISearchManager searchManager,IDiskManager diskManager);
2. Manually creating a Database Instance
Since the database class is public and available, you can directly create a database object and start using it:
var database = new Database(ISearchManager searchManager, IDiskManager diskManager);
See Reference Page for documentation
Limitations & Potential Plans
- Atomicity is only supported for changing rows but not datatable structure.
- Only includes simple add and retrieve, and no foreign keys or custom constraints.
- Search parameters are simple and only allow one search condition.
Exception Handling
Most of the exceptions are still recoverable, meaning when an exception is thrown, the current transaction will abort, reverting to its previous working state. However, exceptions relating to File or locks, specifically LockNotReleasedException which is a custom exception type, will have persisting impacts, so you should probably restart it.
Links
Nuget Package = https://www.nuget.org/packages/Custom_In-Memory_Database
Git Repo = https://github.com/Thet-Wai-123/In-Memory_Database
Acknowledgments
BTree library by CodeExMachina, licensed under GPLv3.0.
AsyncReaderWriterLock by .NEXT, licensed under MIT.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- CodeExMachina.BTree (>= 0.2.0)
- DotNext.Threading (>= 5.23.0)
- Microsoft.Extensions.DependencyInjection (>= 9.0.3)
- Newtonsoft.Json (>= 13.0.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.