The class Entity and the class VersionedEntity are not part of my domain, they are there only because OOP stuff; in practice I don’t want a mapping for those two classes.
To make the matter a little bit more complicated I will add two others classes.
To let ConfORM to discover which is the property represent the version you can implement a IPattern<MemberInfo> and add it to ObjectRelationalMapper.Patterns.Versions but that is only if you like to work a little bit more than necessary.
In this case the most short way, and the most strongly-typed, is using the ConfORM’s capability to understand the polymorphism. In practice:
That done you can continue as usual getting the mappings for your entities; In this case, for instance, it may mean:
If you have to customize the mapping of versions properties, again you can do it class-by-class (working a lot) or again using the ConfORM’s capability to understand the polymorphism:
Now suppose that what you need is a special case where for a class inheriting from VersionedEntity, like above, you have to use another column name than “Revision” (like above). What you have to do is only specify your special case trusting in ConfORM capability to understand the polymorphism:
In this example I shown only a simple usage for the property representing the version for optimistic lock but you can apply the same concept to any property.
Are you ConfORM ?