I’ve an object model I’m persisting to a SQL Compact database using EF 4.2. One of my classes has a flag I use to determine if the object was modified. If the object was never changed from its default value I do not wish to save it to the database. Is there a way I can configure DbModelBuilder to toss out objects based on this property (it’s a bool)? The other option I am considering is overriding DbContext.SaveChanges and just removing the object from the DbSet if the object was not modified. Suggestions?
I’ve an object model I’m persisting to a SQL Compact database using EF 4.2.
Share
If the attached object was not modified it will not be saved to database.
DbContexthas its own change tracking mechanism and it will not use your custom property.