I have changed my MVC app database implementation from database first to code first
. The only thing left is to move Triggers
. I do not know where to put them. Should I put them in Repository
and implement them in add/ edit / delete methods
? Or maybe there is more appropriated place to execute triggers depending on repositories actions. Please let me any ideas of trigger implementation in Code First approach.
Asked
Active
Viewed 1,551 times
1

Tomas
- 17,551
- 43
- 152
- 257
-
Triggers is a somewhat elusive name here, but it's clear from your question what you're talking about. Where did you have them before? What is so different between DBF and CF that the implementation should differ considerably? – Gert Arnold Feb 15 '13 at 22:55
1 Answers
1
Can't offer loads of help here as I've never had to do it, but you could look at overriding DbContext.SaveChanges depending on how many triggers you're talking about...
Update Take a look at this question for a better example.