I am currently evaluating DevForce and I seem to have reached a dead end trying to put a RowVersion attribute in a base entity using Code First. Here is my setup:
- DevForce 6.1.4 release.
- abstract EntityBase containing various "commons" stuff such as Id, CreationDate, ModificationDate, RowVersion...
- Several entity types derive from it.
- Use fluent mapping to setup TPC - Table Per Concrete Type (calling map.MapInheritedProperties() in the EF EntityTypeConfiguration<> classes for derived entities).
- Silverlight 5 client application .
- Separate model project (class library)
If I put the RowVersion property in the EntityBase class, I get the following error at run-time:
"The store generated pattern 'Computed' is not supported for properties that are not of type 'timestamp' or 'rowversion'."
It makes no difference whether I tag the property as a RowVersion either using the [Timestamp] data annotation or using the EF fluent interface.
If I put the RowVersion in the derived entities, I get a compile time error stating that I cannot add concurrency checks in derived classes.
Also, the Id column is only set as Identity for the EntityBase table. The Id column in the tables for the derived classes is NOT set as Identity. As a result, the temporary negative Id assigned by the client (e.g. -100) gets stored in the database such that on the second insert I get a key violation exception.
So I am at a loss here...it seems to me that using a base entity is not that useful unless I am missing a key ingredient...