You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My issue here is that if I am trying to create triggers for auditing, I have to specify each column individually or execute a raw SQL query that looks something like this:
INSERT INTO auditing (SELECT * FROM source WHERE source.something = something)
The issue with this is that the auditing table has to look exactly the same as the source table. But that only allows insertion of one entry per element if you want to have the ID as a primary key. I would want to have an "AuditId" and a "SourceId" but that is not possible when using this query!
So I think it would be cool to have a method that you can use similarly to methods like Insert, Update, Upsert and so on called Audit
Would be cool if this could automatically map the columns with the same name and then you would have the ability to attach another method or perhaps a function argument that maps the rest of the values.
Usage:
modelBuilder.Entity<Source>().BeforeUpdate(trigger =>trigger.Action(action =>action//Does the automatic mapping.Audit<Source,Audit>().HandleUnmapped((source,audit)=>audit.Action="Update")));
The text was updated successfully, but these errors were encountered:
My issue here is that if I am trying to create triggers for auditing, I have to specify each column individually or execute a raw SQL query that looks something like this:
INSERT INTO auditing (SELECT * FROM source WHERE source.something = something)
The issue with this is that the auditing table has to look exactly the same as the source table. But that only allows insertion of one entry per element if you want to have the ID as a primary key. I would want to have an "AuditId" and a "SourceId" but that is not possible when using this query!
So I think it would be cool to have a method that you can use similarly to methods like
Insert
,Update
,Upsert
and so on calledAudit
Would be cool if this could automatically map the columns with the same name and then you would have the ability to attach another method or perhaps a function argument that maps the rest of the values.
Usage:
The text was updated successfully, but these errors were encountered: