EntityFramework code first

Apr 20, 2012 at 2:08 PM

I am trying to create an MVVM application and am using EntityFramework 4.2 Code First for my data access.  I am trying to use Catel as my MVVM framework because I've been impressed with its capabilities. 

I set up my model objects to inherit from DataObjectBase.  However, one thing I noticed is that when my project created the database, each of the generated database tables contain IsDirty and IsReadOnly columns.  Apparently because these are public properties of the DataObjectBase class.

Has anyone else tried using DataObjectBase with EF Code First?  If so, do you have a good way to exclude those values from the database tables?  I was able to exclude them by using Code First's fluent API and adding a statement to ignore each of them in the OnModelCreating method but in a project with numerous entity classes, this would be a drag.

Apr 20, 2012 at 6:39 PM

I have never used it in combination with EF code first. If you create a base class that derives from the DOB, you can definitely put the logic into one class. This makes it easier for you to apply a change to all models at once, so it is definitely recommended.