When Table1.Foo changes, I want to update a column on Table2. What would be easiest is if I could just “run” some custom SQL after the update to Table1 is committed, however there doesn’t seem to be a place to do this.
It seems the “recommended” solution is to override the SaveChanges() method of EntitiesContext. However, I have several dozen models and hundreds of columns – it seems rather hacky and inefficient to execute code every time any model anywhere is changed, and then say “If it happens to be this property of this model, then do this..”
My first approach was to use a database trigger, which would be great. Unfortunately, Oracle doesn’t appear to support this type of updating I need to do in a trigger.
Any other ideas for this sort of thing?
You can create a partial class for the given entity in your project, if you did not create one.
In your partial class, you override PropertyChangedEvent handler to update other table.
I don’t think you have to create a stored procedure for that.