What is the easiest and most efficient way to implement events with changed properties with Entity Framework 4 with POCO support?

Seeing that the ready-made POCO template does not include OnPropertyChanged support for simplicity, what would be the most accurate [and most efficient] way to implement events with changed properties for my POCO objects in Entity Framework 4, similar to the standard EF 4.0 data model that emits these events?

I really want something with high performance, I don’t even remember which property has changed; I would be happy to just get an event when the entity instance / object has any property that has changed.

My immediate suggestion was to implement a strategy like this in the POCO T4 template (.tt) that generates my POCO classes, will I be on the right track? However, I just want to make sure this is the most common approach? Is it already done as a standard POCO template somewhere?

More on EF 4.0 with POCO support: http://blogs.msdn.com/b/adonet/archive/2010/01/25/walkthrough-poco-template-for-the-entity-framework.aspx

Also the standard EF 4.0 POCO Entity Generator Template I am using: http://visualstudiogallery.msdn.microsoft.com/23df0450-5677-4926-96cc-173d02752313?SRC=VSIDE

+4
source share
1 answer

You really answered your question. The transition method is to change the T4 template and add the necessary level of support. If you need some default validation classes created by the entity designer when you are not using the templates or T4 classes created by the auto-tuning entity generator (another T4 template), they should also use OnPropertyChanged .

+1
source

All Articles