|
5 | 5 | [](https://github.com/MPCoreDeveloper/SharpCoreDB/actions) |
6 | 6 | [](https://codecov.io/gh/MPCoreDeveloper/SharpCoreDB) |
7 | 7 |
|
8 | | -A lightweight, encrypted, file-based database engine for .NET that supports SQL operations with built-in security features. Perfect for time-tracking, invoicing, and project management applications. |
| 8 | +A lightweight, encrypted, file-based database engine for .NET 10 that supports SQL operations with built-in security features. Perfect for time-tracking, invoicing, and project management applications. |
9 | 9 |
|
10 | 10 | ## Quickstart |
11 | 11 |
|
@@ -77,10 +77,31 @@ var result = db.ExecuteSQL("SELECT * FROM users"); |
77 | 77 |
|
78 | 78 | SharpCoreDB provides a SQL-compatible interface over encrypted file-based storage, with optional connection pooling and auto-maintenance features. |
79 | 79 |
|
| 80 | +## Project Components |
| 81 | + |
| 82 | +This repository contains several components: |
| 83 | + |
| 84 | +- **SharpCoreDB**: Core database engine library |
| 85 | +- **SharpCoreDB.EntityFrameworkCore**: Entity Framework Core provider for SharpCoreDB |
| 86 | +- **SharpCoreDB.Extensions**: Additional extensions and utilities |
| 87 | +- **SharpCoreDB.Demo**: Console application demonstrating SharpCoreDB usage |
| 88 | +- **SharpCoreDB.Benchmarks**: Performance benchmarks comparing with SQLite and LiteDB |
| 89 | +- **SharpCoreDB.Tests**: Unit tests and integration tests |
| 90 | + |
80 | 91 | ## Installation |
81 | 92 |
|
82 | 93 | Add the SharpCoreDB project to your solution and reference it from your application. |
83 | 94 |
|
| 95 | +For the core database engine: |
| 96 | +```bash |
| 97 | +dotnet add package SharpCoreDB |
| 98 | +``` |
| 99 | + |
| 100 | +For Entity Framework Core support: |
| 101 | +```bash |
| 102 | +dotnet add package SharpCoreDB.EntityFrameworkCore |
| 103 | +``` |
| 104 | + |
84 | 105 | ## Usage |
85 | 106 |
|
86 | 107 | ### Setting Up the Database |
@@ -388,10 +409,36 @@ db.ExecuteSQL("CREATE INDEX idx_user_email ON users (email)"); |
388 | 409 |
|
389 | 410 | // Create a unique index |
390 | 411 | db.ExecuteSQL("CREATE UNIQUE INDEX idx_user_id ON users (id)"); |
| 412 | +``` |
391 | 413 |
|
392 | | -```````` |
| 414 | +### Entity Framework Core Support |
| 415 | + |
| 416 | +SharpCoreDB provides an Entity Framework Core provider for ORM-style database access: |
| 417 | + |
| 418 | +```csharp |
| 419 | +using Microsoft.EntityFrameworkCore; |
| 420 | +using SharpCoreDB.EntityFrameworkCore; |
| 421 | + |
| 422 | +// Install package: dotnet add package SharpCoreDB.EntityFrameworkCore |
| 423 | +
|
| 424 | +// Define your DbContext |
| 425 | +public class MyDbContext : DbContext |
| 426 | +{ |
| 427 | + protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) |
| 428 | + { |
| 429 | + optionsBuilder.UseSharpCoreDB("Data Source=mydb.db;Password=MySecret123"); |
| 430 | + } |
| 431 | +} |
| 432 | + |
| 433 | +// Use it like any EF Core context |
| 434 | +using var context = new MyDbContext(); |
| 435 | +context.Database.EnsureCreated(); |
| 436 | + |
| 437 | +var user = new User { Name = "Alice", Email = "alice@example.com" }; |
| 438 | +context.Users.Add(user); |
| 439 | +context.SaveChanges(); |
| 440 | + |
| 441 | +var users = context.Users.Where(u => u.Name == "Alice").ToList(); |
| 442 | +``` |
393 | 443 |
|
394 | | -⚠️ **Current Implementation Notes**: |
395 | | -- Optimized for DummyTimeProject and time-tracking use cases |
396 | | -- Query execution leverages SharpCoreDB's native SQL engine |
397 | | -- Some advanced EF Core features (lazy loading, change tracking optimization) use default implementations |
| 444 | +**Note**: The EF Core provider is in active development. Some advanced features like complex LINQ queries and lazy loading may use default implementations. |
0 commit comments