A Library for EntityFrameworkCore to support automatically recording data changes history (audit logging), soft-delete, and Snakecase naming convention functionality.
EFCore.Auditing is available on NuGet.
dotnet add package EFCore.Auditing
EFCoreAuditing will recording all the data changing history in one table named 'Audit'.
public class UserDbContext : AuditLogDbContext<Guid>
{
public UserDbContext(DbContextOptions<UserDbContext> dbOptions)
: base(dbOptions)
{
}
public DbSet<Blog> Blogs { get; set; }
public DbSet<Post> Posts { get; set; }
protected override void OnModelCreating(ModelBuilder builder)
{
base.OnModelCreating(builder);
builder
.SnakeCaseifyNames() //Change all the table names and column names to snake_case.
.EnableSoftDelete(); //Enable soft-delete functionality.
}
}
- Fork it ( https://github.com/OKTAYKIR/EFCoreAuditing/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
Please ⭐️ this repository if this project helped you!
MIT License