Ryan D'Baisse
Ryan D'Baisse

Reputation: 863

How to Override SaveChanges Using Model First in EF5

How can I override the SaveChanges() method in EF5 WITHOUT using a code-first approach? Some of my tables use a char(32) PK (basically, a stripped down GUID) that must be stuffed prior to save. Same with the audit trail. Every search I have tried always assumes that a code-first approach and NOT model-first.

Upvotes: 0

Views: 74

Answers (1)

user3137652
user3137652

Reputation: 366

The generated context class is partial. Just add another code file where you extend the class and override SaveChanges there.

Upvotes: 1

Related Questions