Skip to content

benbristow/EntityFrameworkCore.CreatedUpdatedDate

Repository files navigation

EntityFrameworkCore.CreatedUpdatedDate

Build project

Add CreatedDate/UpdatedDate to your entities and have them automatically updated when saving to the database.

Usage

Register the interceptor in your DbContext:

protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
    optionsBuilder.AddCreatedUpdatedInterceptor();
}

Implement IEntityWithCreatedUpdatedDate on your entities:

public class MyEntity : IEntityWithCreatedUpdatedDate
{
    public int Id { get; set; }
    public DateTimeOffset? CreatedDate { get; set; }
    public DateTimeOffset? UpdatedDate { get; set; }
}

About

Add CreatedDate/UpdatedDate to your entities and have them automatically updated when saving to the database

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published

Languages