I am using Entity Framework and when I insert or update Row in Table I would like to perform additional action. Not only stored procedure from database but actual function in code - preferably event based. (asynchronous execution) Both scenarios should trigger sending some message to a handler or in other way enable execution of a function.
1) create
var Row = DbContext.Table.GetById(Id);
Row.SomeColumn = newValue;
DbContext.SaveChanges();
2) update
var Row = new Row(valOfColumn1, ...);
DbContext.Table.AddObject(Row);
DbContext.SaveChanges();
Before you answer:
Finding places when currently updates and inserts are performed does not cover future usages which should always be connected with execution of mentioned extra function.
Establishing that one should always create or update Table with use of dedicated function is not an option as I need to assume that people will not be aware of necessity of usage mentioned extra function.