Creomobile.Data.EFCore.Timestamps
0.3.0
dotnet add package Creomobile.Data.EFCore.Timestamps --version 0.3.0
NuGet\Install-Package Creomobile.Data.EFCore.Timestamps -Version 0.3.0
<PackageReference Include="Creomobile.Data.EFCore.Timestamps" Version="0.3.0" />
<PackageVersion Include="Creomobile.Data.EFCore.Timestamps" Version="0.3.0" />
<PackageReference Include="Creomobile.Data.EFCore.Timestamps" />
paket add Creomobile.Data.EFCore.Timestamps --version 0.3.0
#r "nuget: Creomobile.Data.EFCore.Timestamps, 0.3.0"
#:package Creomobile.Data.EFCore.Timestamps@0.3.0
#addin nuget:?package=Creomobile.Data.EFCore.Timestamps&version=0.3.0
#tool nuget:?package=Creomobile.Data.EFCore.Timestamps&version=0.3.0
Creomobile.Data.EFCore.Timestamps
The EF Core side of the timestamp contracts in
Creomobile.Data.Abstractions:
CreatedAt and UpdatedAt are maintained for you, and deleting an entity that carries
DeletedAt becomes a soft delete.
Usage
services.AddDbContext<AppDbContext>(options => options
.UseNpgsql(connectionString)
.UseTimestamps());
public sealed class Customer : EntityBase<Guid>, ITimestamps
{
public string Name { get; set; } = null!;
}
EntityBase<TId> and the timestamp interfaces come from Creomobile.Data.Abstractions,
installed automatically as a dependency.
UseTimestamps(TimeProvider? timeProvider = null)
Maintains the timestamp interfaces from Creomobile.Data.Abstractions — ICreatedAt,
IUpdatedAt, IDeletedAt, each of which works independently, with ITimestamps
aggregating all three:
- Insert —
CreatedAtandUpdatedAtreceive the same UTC instant. - Update —
UpdatedAtis refreshed;CreatedAtis protected from accidental overwrites. - Delete of an
IDeletedAtentity becomes a soft delete: the row is kept withDeletedAtset, owned entities are retained; settingDeletedAtback tonullrestores the entity. Regular (non-owned) dependents still follow the normal delete cascade — implementIDeletedAton them or adjustDeleteBehaviorif they must survive the parent's soft delete. - A named query filter (
"SoftDelete") hides soft-deleted entities from queries; bypass it per query withIgnoreQueryFilters()or selectively withIgnoreQueryFilters([SoftDeleteQueryFilterConvention.FilterKey]). - All entities saved together share one instant; pass a
TimeProviderfor deterministic tests.
Repeated calls are no-ops: the first call wins, including its TimeProvider.
See the XML documentation of UseTimestamps and SoftDeleteQueryFilterConvention for exact
semantics and known limitations.
Requirements
- .NET 10+
- EF Core 10
| 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
- Creomobile.Data.Abstractions (>= 0.3.0)
- Microsoft.EntityFrameworkCore.Relational (>= 10.0.12)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.