|
7 | 7 |
|
8 | 8 | [](https://opensource.org/licenses/MIT) |
9 | 9 | [](https://dotnet.microsoft.com/download) |
10 | | - [](https://www.nuget.org/packages/SharpCoreDB.EntityFrameworkCore) |
| 10 | + [](https://www.nuget.org/packages/SharpCoreDB.EntityFrameworkCore) |
11 | 11 | [](https://docs.microsoft.com/ef/core/) |
12 | 12 |
|
13 | 13 | </div> |
|
18 | 18 |
|
19 | 19 | Entity Framework Core 10 database provider for **SharpCoreDB** — a high-performance encrypted embedded database engine. Use familiar EF Core APIs with SharpCoreDB's AES-256-GCM encryption, SIMD acceleration, and zero-config deployment. |
20 | 20 |
|
| 21 | +**Latest (v1.3.0):** Fixed CREATE TABLE COLLATE clause emission for UseCollation() ✅ |
| 22 | + |
21 | 23 | --- |
22 | 24 |
|
23 | 25 | ## Installation |
24 | 26 |
|
25 | 27 | ```bash |
26 | | -dotnet add package SharpCoreDB.EntityFrameworkCore |
| 28 | +dotnet add package SharpCoreDB.EntityFrameworkCore --version 1.3.0 |
27 | 29 | ``` |
28 | 30 |
|
29 | 31 | **Requirements:** |
30 | 32 | - .NET 10.0 or later |
31 | 33 | - Entity Framework Core 10.0.2 or later |
32 | | -- SharpCoreDB 1.0.6 or later (installed automatically) |
| 34 | +- SharpCoreDB 1.3.0 or later (installed automatically) |
33 | 35 |
|
34 | 36 | --- |
35 | 37 |
|
@@ -196,6 +198,73 @@ builder.Services.AddDbContext<AppDbContext>(options => |
196 | 198 | | **Spatial Types** | Not supported (no geometry/geography) | |
197 | 199 | | **JSON Columns** | Not supported | |
198 | 200 | | **Batch UPDATE/DELETE** (`ExecuteUpdate`/`ExecuteDelete`) | Not yet implemented | |
| 201 | +| **COLLATE Support** | ✅ Fixed in v1.3.0 - CREATE TABLE now emits COLLATE clauses | |
| 202 | + |
| 203 | +--- |
| 204 | + |
| 205 | +## Collation Support (v1.3.0+) |
| 206 | + |
| 207 | +SharpCoreDB supports column-level collations including `NOCASE` for case-insensitive comparisons and `LOCALE()` for culture-specific sorting. |
| 208 | + |
| 209 | +### Basic Collation Configuration |
| 210 | + |
| 211 | +```csharp |
| 212 | +public class User |
| 213 | +{ |
| 214 | + public int Id { get; set; } |
| 215 | + public required string Username { get; set; } |
| 216 | + public required string Email { get; set; } |
| 217 | +} |
| 218 | + |
| 219 | +public class AppDbContext : DbContext |
| 220 | +{ |
| 221 | + public DbSet<User> Users => Set<User>(); |
| 222 | + |
| 223 | + protected override void OnModelCreating(ModelBuilder modelBuilder) |
| 224 | + { |
| 225 | + modelBuilder.Entity<User>(entity => |
| 226 | + { |
| 227 | + // Case-insensitive username |
| 228 | + entity.Property(e => e.Username) |
| 229 | + .HasMaxLength(50) |
| 230 | + .UseCollation("NOCASE"); // ✅ Fixed in v1.3.0 |
| 231 | + |
| 232 | + // Locale-specific email sorting |
| 233 | + entity.Property(e => e.Email) |
| 234 | + .HasMaxLength(100) |
| 235 | + .UseCollation("LOCALE(\"en-US\")"); |
| 236 | + }); |
| 237 | + } |
| 238 | +} |
| 239 | +``` |
| 240 | + |
| 241 | +### Generated SQL (v1.3.0+) |
| 242 | + |
| 243 | +```sql |
| 244 | +CREATE TABLE User ( |
| 245 | + Id INTEGER PRIMARY KEY AUTO, |
| 246 | + Username TEXT COLLATE NOCASE NOT NULL, |
| 247 | + Email TEXT COLLATE LOCALE("en-US") NOT NULL |
| 248 | +) |
| 249 | +``` |
| 250 | + |
| 251 | +### Direct SQL Queries with Collations |
| 252 | + |
| 253 | +```csharp |
| 254 | +// Case-insensitive WHERE clause (uses NOCASE from column definition) |
| 255 | +var users = await db.Users |
| 256 | + .FromSqlRaw("SELECT * FROM User WHERE Username = 'ALICE'") |
| 257 | + .ToListAsync(); |
| 258 | + |
| 259 | +// Will match 'alice', 'Alice', 'ALICE', etc. |
| 260 | +``` |
| 261 | + |
| 262 | +### Known Limitations |
| 263 | + |
| 264 | +- **EF Core LINQ Query Provider**: Full LINQ query translation for collations is pending infrastructure work |
| 265 | +- **Workaround**: Use `FromSqlRaw` for complex collation queries or call direct SQL via `ExecuteQuery()` |
| 266 | +- **What Works**: CREATE TABLE emission, direct SQL queries, case-insensitive WHERE clauses |
| 267 | +- **What's Pending**: Full LINQ expression translation (e.g., `db.Users.Where(u => u.Username == "ALICE")`) |
199 | 268 |
|
200 | 269 | --- |
201 | 270 |
|
@@ -383,7 +452,7 @@ MIT License — see [LICENSE](https://github.com/MPCoreDeveloper/SharpCoreDB/blo |
383 | 452 |
|
384 | 453 | --- |
385 | 454 |
|
386 | | -**Version**: 1.0.6 |
| 455 | +**Version**: 1.3.0 |
387 | 456 | **Last Updated**: 2026 |
388 | | -**Compatibility**: .NET 10.0+, EF Core 10.0.2+, SharpCoreDB 1.0.6, C# 14 |
| 457 | +**Compatibility**: .NET 10.0+, EF Core 10.0.2+, SharpCoreDB 1.3.0, C# 14 |
389 | 458 | **Platforms**: Windows, Linux, macOS, Android, iOS, IoT (x64, ARM64) |
0 commit comments