SoloDB merges the flexibility of document databases with the reliability of SQL, built on SQLite using JSONB. This serverless .NET library offers a simple API, full ACID support, and powerful LINQ capabilities, making data management efficient and straightforward for developers.
SoloDB is an embedded database solution that seamlessly integrates the capabilities of NoSQL and SQL, built on top of SQLite and utilizing the JSONB data type. This innovative database system caters to .NET developers looking for a reliable, fast, and lightweight database without the need for server management.
Create a database either in-memory or on-disk with the following code:
using var onDiskDB = new SoloDB("path/to/database.db");
using var inMemoryDB = new SoloDB("memory:database-name");
Define data models and access collections easily:
public class User
{
public long Id { get; set; }
public string Name { get; set; }
public int Age { get; set; }
}
var db = new SoloDB("memory:my-app");
var users = db.GetCollection<User>();
var untypedUsers = db.GetUntypedCollection("User");
Implement custom ID strategies:
public class MyStringIdGenerator : IIdGenerator<MyCustomIdType>
{
public object GenerateId(ISoloDBCollection<MyCustomIdType> col, MyCustomIdType item)
{
...
}
}
Create indexes for efficient data management:
public class IndexedProduct
{
[Indexed(/* unique = */ true)]
public string SKU { get; set; }
}
Execute actions within transactions to ensure consistency:
var _result = db.WithTransaction<object>(tx => {
var collection = tx.GetCollection<ulong>();
// Your transactional logic here
});
Store objects of different types in a single collection:
public abstract class Shape
{
public long Id { get; set; }
public string Color { get; set; }
}
var shapes = db.GetCollection<Shape>();
Manage files effectively within your database environment:
var fs = db.FileSystem;
fs.Upload(filePath, stream);
For full examples, refer to the detailed code snippets available in the README.
SoloDB serves as a modern alternative suitable for applications requiring both relational and document-oriented data handling. Its combination of performance, simplicity, and reliability positions it as a powerful tool for developers in the .NET ecosystem.
No comments yet.
Sign in to be the first to comment.