audit.net

Audit trail with Entity Framework Core

痴心易碎 提交于 2020-11-24 19:59:08
问题 I have an ASP.NET core 2.0 using Entity Framework core on a SQL Server db. I have to trace and audit all the stuff made by the users on the data. My goal is to have an automatic mechanism writing all what is happening. For example, if I have the table Animals, I want a parallele table "Audit_animals" where you can find all the info about the data, the operation type (add, delete, edit) and the user who made this. I already made this time ago in Django + MySQL, but now the environment is

Audit trail with Entity Framework Core

强颜欢笑 提交于 2020-11-24 19:56:12
问题 I have an ASP.NET core 2.0 using Entity Framework core on a SQL Server db. I have to trace and audit all the stuff made by the users on the data. My goal is to have an automatic mechanism writing all what is happening. For example, if I have the table Animals, I want a parallele table "Audit_animals" where you can find all the info about the data, the operation type (add, delete, edit) and the user who made this. I already made this time ago in Django + MySQL, but now the environment is

In Audit.Net is there a way to use multiple output provider?

北城余情 提交于 2020-08-09 14:09:17
问题 I tried setting up the configuration below however, I think only one of them is being used. Is there a way to chain the two or is there any other way to use multiple output provider? Audit.Core.Configuration.Setup() .UseElasticsearch(config => config .ConnectionSettings(new Uri(elasticUri)) .Index("sample-index") .Id(ev => Guid.NewGuid())); Audit.Core.Configuration.Setup() .UseUdp(config => config .RemoteAddress("127.0.0.1") .RemotePort(6060)); 回答1: The DataProvider is globally shared across

How do I target another database with Audit.Net - Audit.EntityFramework.Core

坚强是说给别人听的谎言 提交于 2020-01-05 07:55:08
问题 I'm trying to implement the Audit.EntityFramework.Core package from the Audit.Net repository but am running into some difficulty. I'm unable to save changes or target a different database. I've modified my SaveChanges and SaveChangesAsync function to call the Audit.Net DbContextHelper class's save functions but I'm missing something. Is there a way to do the following? Target another database for storing audit data using an audit DbContext that inherits from the DbContext I'm trying to audit?

Hold Old and New value in SaveChange as DbEntityEntry.Entity to Audit

為{幸葍}努か 提交于 2019-12-23 00:41:09
问题 As you know we can Audit object in SaveChange() but I have some problem with Modified and Deleted entities as following, First I am using Audit.Net(this is very simple to use) to Audit my objects the below method should do audit as: private int SaveAuditRecord(DbEntityEntry dbEntry, string userGUID) { Logging.Log(LoggingMode.Error, "Saving Audid Entry{0}....", dbEntry.ToString()); DateTime changeTime = DateTime.UtcNow; TableAttribute tableAttr = dbEntry.Entity.GetType().GetCustomAttributes

Dynamic audit table creation via Migrations

心已入冬 提交于 2019-12-11 00:59:52
问题 Using .Net Core 2.1 and Audit.NET EF 12.1.10, I'm trying to add a migration that includes the audit tables but when invoking Add-Migration, no audit tables are generated in the migration. I assumed that using the "dynamic" audit will do this automagically. I don't have any audit interfaces-- I am leaving this up to Audit.NET. Below is in my Startup: var serviceProvider = services.BuildServiceProvider(); Audit.EntityFramework.Configuration.Setup() .ForContext<MainDbContext>(config => config

Hold Old and New value in SaveChange as DbEntityEntry.Entity to Audit

那年仲夏 提交于 2019-12-07 02:32:27
As you know we can Audit object in SaveChange() but I have some problem with Modified and Deleted entities as following, First I am using Audit.Net (this is very simple to use) to Audit my objects the below method should do audit as: private int SaveAuditRecord(DbEntityEntry dbEntry, string userGUID) { Logging.Log(LoggingMode.Error, "Saving Audid Entry{0}....", dbEntry.ToString()); DateTime changeTime = DateTime.UtcNow; TableAttribute tableAttr = dbEntry.Entity.GetType().GetCustomAttributes(typeof(TableAttribute), true).SingleOrDefault() as TableAttribute; string tableName = tableAttr != null