Our company did not properly design Address Record Code Module. Developers are updating Address SQL table with Multiple Service Methods, and are not updating AddressHistory Sql table. They're asking me to unify/resolve the issue :) . What are some methods to resolve this?

I came up with these 3 alternatives. Just curious if there are anymore anyone can think of?

1) Create a common Repository function which updates Address History? Ask everyone to utilize this and app this to their code?

2) Should I create an IAuditable Interface that will intercept DB SaveChanges and update Address History?


3) Utilize SQL Triggers (Sql temporal tables do not apply history changes in a customized manner)

Currently applying Net Core 2, Entity Framework, and SQL server

  • The solution you ultimately decide on will depend on factors like performance and maintainability. – Robert Harvey Jun 4 '20 at 2:08
  • Hi @RobertHarvey well my question is, is there another solution I am missing, maybe #4 or #5? – user354368 Jun 4 '20 at 5:24
  • Basically you already know the answer. Triggers. I don't often use triggers, but this seems an appropriate use case for them. You cannot circumvent the trigger, and this prevents a lot of code changes elsewhere. – Greg Burghardt Jun 4 '20 at 19:27
  • hi @GregBurghardt thought triggers would be the worst option due to performance reasons, sql optimization – user354368 Jun 4 '20 at 19:30
  • I've learned through the years that thinking something is a performance problem and measuring a performance problem are two entirely different things. Build first. Measure. Then optimize. I hope you end up with fewer migraine headaches than I have. – Greg Burghardt Jun 4 '20 at 19:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy