MagicCSharp.Data.EntityFramework
1.0.0
See the version list below for details.
dotnet add package MagicCSharp.Data.EntityFramework --version 1.0.0
NuGet\Install-Package MagicCSharp.Data.EntityFramework -Version 1.0.0
<PackageReference Include="MagicCSharp.Data.EntityFramework" Version="1.0.0" />
<PackageVersion Include="MagicCSharp.Data.EntityFramework" Version="1.0.0" />
<PackageReference Include="MagicCSharp.Data.EntityFramework" />
paket add MagicCSharp.Data.EntityFramework --version 1.0.0
#r "nuget: MagicCSharp.Data.EntityFramework, 1.0.0"
#:package MagicCSharp.Data.EntityFramework@1.0.0
#addin nuget:?package=MagicCSharp.Data.EntityFramework&version=1.0.0
#tool nuget:?package=MagicCSharp.Data.EntityFramework&version=1.0.0
MagicCSharp.Data.EntityFramework
Entity Framework Core implementation of the repository contracts in MagicCSharp.Data. Provider-agnostic; add
MagicCSharp.Data.Postgres for PostgreSQL wiring.
The three types per entity
| Type | Role |
|---|---|
Order |
What the application passes around. Immutable record. |
OrderEdit |
The writable fields. Order derives from it, so an entity is accepted wherever an edit is. |
OrderDal |
The row. EF attributes, and the mapping in ToEntity() / Apply(). |
The split is what keeps EF attributes and column names out of business logic, and what makes "these fields can be written" a compile-time fact rather than a convention.
Base classes
Pick by key shape, then by what the entity needs:
| Id (Snowflake) | Key (string) | |
|---|---|---|
| CRUD | BaseIdRepository |
BaseKeyRepository |
| + pagination | BaseIdPaginatedRepository |
BaseKeyPaginatedRepository |
| + soft delete | BaseIdSoftDeleteRepository |
BaseKeySoftDeleteRepository |
| + search | BaseIdSearchRepository |
BaseKeySearchRepository |
A derived repository supplies CreateDal and ApplyFilter; everything else is inherited.
What the base classes handle
Batch writes that fail as a unit rather than half-applying. Re-reading after create and update so navigation
properties are populated rather than silently empty. Stamping Updated only when something actually changed,
so a no-op write does not look like an edit. A context per operation from the factory, so a repository is safe
to hold as a singleton.
MagicDbContext
Derive your context from it for two conventions: enums stored as their names, so inserting a member in the
middle of an enum does not change the meaning of rows already written; and DateTimeOffset normalized to UTC
before it is written, so a value does not come back with a different offset than it went in with.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. 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. |
-
net9.0
- MagicCSharp.Data (>= 1.0.0)
- Microsoft.EntityFrameworkCore (>= 9.0.0)
- Microsoft.EntityFrameworkCore.Relational (>= 9.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on MagicCSharp.Data.EntityFramework:
| Package | Downloads |
|---|---|
|
MagicCSharp.Data.Postgres
PostgreSQL wiring for MagicCSharp.Data.EntityFramework: a pooled context factory with sane pool and retry settings that fails fast on a bad connection string, a design-time factory for dotnet ef, and a command interceptor that normalizes DateTimeOffset parameters to UTC so timestamptz predicates bind on any machine. |
GitHub repositories
This package is not used by any popular GitHub repositories.