Reputation: 13
I started working on a project in my work that doesn't have any documentation, and the person who developed the project in the first place isn't avalaible anymore.
There is this piece of code for doing and update to the database
_report = db.Report.Where(x => x.IdReport == ReportId).FirstOrDefault();
db.Report.Attach(_report);
_report.attr1 = reportmodel.attr1;
_report.attr2 = reportmodel.attr2;
_report.attr3 = reportmodel.attr3;
if (db.SaveChanges() != 0)
{
return View(reportmodel)
}
Looks fine and indeed does the update to the database in the table "Report", but additionally it is being inserted in another table "ReportLog" the detail of the change (orginal value, new value), I believe this is being done somehow in the SaveChanges().
So my question is where can I find where those insertions to the log table are being executed?
I have checked in the model if the table "Report" has some stored procedure mapped in the update action, checked for triggers and stored procedures in the database and used Find(Ctrl+f) to check for "ReportLog" in the entire solution, but I couldn't find where the insertion is being executed.
And something really weird is that this happens for the "Report" table only, using SaveChanges() for other updates in other tables does only what is expected
Upvotes: 0
Views: 53