Craticula.EntityFrameworkCore
1.3.0
dotnet add package Craticula.EntityFrameworkCore --version 1.3.0
NuGet\Install-Package Craticula.EntityFrameworkCore -Version 1.3.0
<PackageReference Include="Craticula.EntityFrameworkCore" Version="1.3.0" />
<PackageVersion Include="Craticula.EntityFrameworkCore" Version="1.3.0" />
<PackageReference Include="Craticula.EntityFrameworkCore" />
paket add Craticula.EntityFrameworkCore --version 1.3.0
#r "nuget: Craticula.EntityFrameworkCore, 1.3.0"
#:package Craticula.EntityFrameworkCore@1.3.0
#addin nuget:?package=Craticula.EntityFrameworkCore&version=1.3.0
#tool nuget:?package=Craticula.EntityFrameworkCore&version=1.3.0
Craticula.EntityFrameworkCore
The Entity Framework Core execution adapter of Craticula. It compiles the canonical IR straight to IQueryable<T>
expression trees and runs them, so no SQL text is produced here. It works with any relational provider (you choose
the provider package) and supports paging, row counts and streamed export.
Install
dotnet add package Craticula.EntityFrameworkCore
Depends on Microsoft.EntityFrameworkCore.Relational [10.0.12, 11.0).
Example
using Craticula.Core.Ir;
using Craticula.Core.Schema;
using Craticula.EntityFrameworkCore;
public static class Example
{
public static async Task<EfCoreGridPage> Fetch<TRow>(
IQueryable<TRow> source, GridSchema schema, FilterNode? filter, IReadOnlyList<SortItem>? sort, PageSpec page)
where TRow : class
{
var request = new EfCoreQueryRequest { Schema = schema, Filter = filter, Sort = sort, Page = page };
// EfCoreProviderSemantics.Sqlite is the one measured preset; declare your own for other engines.
return await EfCoreGridQuery.FetchPageAsync(
source, request, EfCoreProviderSemantics.Sqlite, includeRowCount: true);
}
}
Two host obligations that fail silently
Both run without error and return wrong rows, so the adapter documents them; it cannot see the host's model or collations.
- SQLite instants. Store a
datetimeasyyyy-MM-ddTHH:mm:ss.fffZtext (SEM-4) and map everyDateTimeto and from that text in yourDbContext(configurationBuilder.Properties<DateTime>().HaveConversion<YourStoredInstantConverter>()). EF's own mapping binds a value asyyyy-MM-dd HH:mm:ss; on the value's own date'T'sorts after a space. Without the mapping aneqat a stored time finds nothing, aneqfinds every row, a range bound counts the whole bound date as later (13,335 rows for 13,321 on the demo), and a datetime-sorted export repeats or drops rows at chunk edges (20,060 and 19,947 rows for 20,000). An export whose walk meets the row the previous chunk ended on stops with an exception rather than loop. The mapping writes millisecond text, so a finer-than-millisecond bound is truncated, not floored or ceiled as the SQL compiler does (SEM-4). PatternMatchFoldsCasesays what the engine'sLIKEdoes. SQLite:true(itsLIKEfolds ASCII case whatever the column is, andtrueis what makes acaseSensitivity: "sensitive"field refuse instead of answering case-insensitively). SQL Server and MySQL:false, unless every searchable column's collation folds case, becausetruesends a bareLIKEthat follows the column's collation and a binary-collated column (..._BIN2,utf8mb4_bin) then matches exact case only:contains "germ"finds noGermany.falselowers both sides and is right for every case-insensitive field.
EfCoreHostObligationTests shows each: wrong rows without it, right rows with it.
Datetime cells
A datetime cell leaves a page or an export row as a UTC instant, whatever kind the provider materialised (SEM-4, result side): a
UTC value is kept, a local one is converted, a zone-less one (SQL Server datetime2, MySQL DATETIME, SQLite text) is read as UTC.
A host needs no UTC value converter for the way out. The values it stores must still be UTC readings.
Compatibility
Implements Craticula spec version 0.3.0 (the language-neutral semantics and conformance fixtures in the
repository, spec/). Targets .NET 10.
License
Apache-2.0. Source and issues: https://github.com/pluries/craticula.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. 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. |
-
net10.0
- Craticula.Core (>= 1.3.0)
- Microsoft.EntityFrameworkCore.Relational (>= 10.0.12 && < 11.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.