I'm using Entity Framework for the first time, and I need to add business logic before inserting new objects into the db, here are the options I thought about:

  1. Implement business logic on the DataContext level - by overriding SaveChanges method
  2. Implement business logic for each entity using OnPropertyChanging partial method
  3. Wrap the generated code in a custom class that implement the validation layer.

Which method is best practice when managing business logic on Entity Framework

Edit
Report