| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Graph repository implementations for the LiteGraph library, providing persistent storage backends for graph data structures.
// Option 1: DuckDB (SQL-based, best for analytics)
var duckDb = new DuckDBGraphRepository("Data Source=mydb.duckdb");
duckDb.InitializeRepository();
// Option 2: FastDB (NoSQL, best for performance)
var fastDb = new FastDBGraphRepository("./mydb.fastdb",
new FastDBOptions { Serializer = SerializerType.MessagePack_Contract });
fastDb.InitializeRepository();
// Option 3: LiteDB (NoSQL, best for flexibility)
var liteDb = new LiteDBGraphRepository("mydata.db");
liteDb.InitializeRepository();
// Use any repository through the same LiteGraph interfaces
var tenant = await repository.Tenant.Create(new TenantMetadata
{
GUID = Guid.NewGuid(),
Name = "My Tenant"
});This library provides concrete implementations of the LiteGraph GraphRepositoryBase abstract class, enabling you to store and query graph data using various database backends.
| Feature | DuckDBGraphRepository | FastDBGraphRepository | LiteDBGraphRepository |
|---|---|---|---|
| Storage Type | SQL (Columnar) | NoSQL (Key-Value Collections) | NoSQL (Document/BSON) |
| Best For | Analytics, Complex Queries | Simple CRUD, High Performance | General Purpose, Flexible Queries |
| ACID Compliance | ✅ Full | ⚠️ Limited | ✅ Full |
| Schema Required | ✅ Yes | ❌ No | ❌ No |
| Backup Support | ✅ Native | ⚠️ Manual | ⚠️ Pending |
| In-Memory Mode | ✅ Yes | ❌ No | ✅ Yes |
| Serialization | SQL | MessagePack/JSON/Binary | BSON |
| File Size | Large | Small | Medium |
| Query Performance | Excellent (SQL) | Very Fast (Direct Key Access) | Good (LINQ with Indexes) |
| Setup Complexity | Medium | Low | Low |
| LINQ Support | ❌ No | ❌ No | ✅ Full |
| Encryption | ❌ No | ❌ No | ✅ Yes |
| Cross-Platform | ✅ Yes | ✅ Yes | ✅ Yes |
DuckDBGraphRepository: Choose when you need complex analytical queries, reporting, or data warehousing capabilities. Best for read-heavy workloads with complex joins and aggregations.
FastDBGraphRepository: Choose when you need lightweight embedded storage with simple key-based access patterns. Best for write-heavy workloads, caching, or when storage size is a concern.
LiteDBGraphRepository: Choose when you need a balance of features - document flexibility, LINQ queries, ACID transactions, and optional encryption. Best for general-purpose applications requiring flexible schema and good query performance.
A high-performance graph repository implementation using DuckDB, an in-process SQL OLAP database optimized for analytical queries.
using WebNet.LiteGraphExtensions.GraphRepositories;
// Create repository with file-based storage
var repository = new DuckDBGraphRepository("Data Source=mydb.duckdb");
// Initialize the database schema
repository.InitializeRepository();
// Use the repository through LiteGraph interfaces
var tenant = await repository.Tenant.Create(new TenantMetadata
{
GUID = Guid.NewGuid(),
Name = "My Tenant"
});
var graph = await repository.Graph.Create(new Graph
{
GUID = Guid.NewGuid(),
TenantGUID = tenant.GUID,
Name = "My Graph"
});
// Flush changes to disk
repository.Flush();
// Backup database
await repository.Admin.Backup("./backup");
// Dispose when done
repository.Dispose();DuckDB supports standard ADO.NET connection string format:
The DuckDB implementation creates the following tables:
All tables include appropriate foreign keys, indexes, and constraints for data integrity.
The DuckDB repository provides:
Note: Most CRUD operations currently throw NotImplementedException and require implementation based on your specific use case.
A lightweight, embedded graph repository implementation using Stellar.FastDB, a high-performance NoSQL database with collection-based storage.
using WebNet.LiteGraphExtensions.GraphRepositories;
using Stellar.Collections;
// Create repository with file-based storage
var options = new FastDBOptions
{
Serializer = SerializerType.MessagePack_Contract
};
var repository = new FastDBGraphRepository("./mydb.fastdb", options);
// Collections are automatically created on first access
repository.InitializeRepository();
// Use the repository through LiteGraph interfaces
var tenant = await repository.Tenant.Create(new TenantMetadata
{
GUID = Guid.NewGuid(),
Name = "My Tenant"
});
var graph = await repository.Graph.Create(new Graph
{
GUID = Guid.NewGuid(),
TenantGUID = tenant.GUID,
Name = "My Graph"
});
// Flush happens automatically, but can be called explicitly
repository.Flush();
// Dispose when done
repository.Dispose();FastDB supports various serialization formats:
The FastDB implementation stores data in typed collections:
Collections are automatically created when first accessed, with no schema definition required.
The FastDB repository provides:
Note: Most CRUD operations currently throw NotImplementedException and require implementation based on your specific use case.
A versatile document-oriented graph repository implementation using LiteDB, a lightweight NoSQL embedded database for .NET with MongoDB-like features.
using WebNet.LiteGraphExtensions.GraphRepositories;
// Create repository with file-based storage
var repository = new LiteDBGraphRepository("mydata.db");
// Or use connection string for advanced options
var repository = new LiteDBGraphRepository("Filename=mydata.db;Connection=shared");
// Initialize and create indexes
repository.InitializeRepository();
// Use the repository through LiteGraph interfaces
var tenant = await repository.Tenant.Create(new TenantMetadata
{
GUID = Guid.NewGuid(),
Name = "My Tenant"
});
var graph = await repository.Graph.Create(new Graph
{
GUID = Guid.NewGuid(),
TenantGUID = tenant.GUID,
Name = "My Graph"
});
// Flush changes to disk (checkpoint)
repository.Flush();
// Dispose when done
repository.Dispose();LiteDB supports various connection string options:
The LiteDB implementation stores data in BSON document collections:
Indexes are automatically created during initialization for optimal query performance.
The LiteDB repository provides:
Note: Most CRUD operations currently throw NotImplementedException and require implementation based on your specific use case.
All repository implementations follow a common pattern:
GraphRepositoryBase (abstract)
├── DuckDBGraphRepository
│ ├── AdminMethods (IAdminMethods)
│ ├── TenantMethods (ITenantMethods)
│ ├── UserMethods (IUserMethods)
│ ├── CredentialMethods (ICredentialMethods)
│ ├── LabelMethods (ILabelMethods)
│ ├── TagMethods (ITagMethods)
│ ├── VectorMethods (IVectorMethods)
│ ├── GraphMethods (IGraphMethods)
│ ├── NodeMethods (INodeMethods)
│ ├── EdgeMethods (IEdgeMethods)
│ ├── BatchMethods (IBatchMethods)
│ └── VectorIndexMethods (IVectorIndexMethods)
│
├── FastDBGraphRepository
│ └── (same interface structure)
│
└── LiteDBGraphRepository
└── (same interface structure)
Each implementation provides the same 12 interface implementations, ensuring consistent API across all storage backends.
dotnet add package WebNet.LiteGraphExtensions.GraphRepositoriesThe library includes comprehensive unit tests for all implementations:
dotnet testTest coverage includes:
All 38 tests validate:
Contributions are welcome! Please ensure all tests pass before submitting pull requests.
See LICENSE.txt for details.
| Back | FazBrowse Home | New Git URL |