How to get user information in DbContext using Net Core
I am trying to develop a class library in which i want to implement custom DbContext . In the SaveChanges method of the DbContext , i need to get current user’s information(department, username etc.) for auditing purpose. Some part of the DbContext code is below: public override int SaveChanges() { // find all changed entities which is ICreateAuditedEntity var addedAuditedEntities = ChangeTracker.Entries<ICreateAuditedEntity>() .Where(p => p.State == EntityState.Added) .Select(p => p.Entity); var now = DateTime.Now; foreach (var added in addedAuditedEntities) { added.CreatedAt = now; added