Q:

How to Create Partial Classes from CodeFirst

I am working with an application that uses EF, in a code-first approach so there are several domain classes.
I am in need of getting access to ObjectContext.SavingChanges so I can operate on a few newly-added business rules.From what I have seen here on SO and in Julie Lerman's book I need to create a partial class with the same name as the generated partial class(es) generated by EF.
I cannot seem to find the location of these generated EF classes. Without that I don't have class names or namespaces to use for my partial class implementation.
Questions
1. Where can I find these generated EF classes?
2. Once found, which one do I use as my partial class if I need to get access to ObjectState.SavingChanges?

A:

For partial class, you only need to create new class with the same name as your ef class and you need to mark them as partial in the same assembly as you define your ef context. 
But, if you want to access SavingChanges(), you need to create your own class context by extending ObjectContext, so you can override  ObjectContext.SavingChanges() to add your own business process.
hope it will help you. 

