Is it possible perform actions in POCO before insert/update?
问题 Let's assume this Entity Framework sample: public class User { public int UserID { get; set; } public string Name { get; set; } } public class MyDbContext : DbContext { public DbSet<User> Users { get; set; } } class Program { static void Main(string[] args) { using (var db = new MyDbContext ()) { var user = new User { Name = "Foo"}; db.Users.Add(user); db.SaveChanges(); Console.WriteLine("Press any key to exit..."); Console.ReadKey(); } } } I want add to User class events, like "BeforeInsert"