I've got a custom include template that creates an additional constructor on entities that have a specific field for concurrency control. This has been working fine until it came to working with inherited entities. The problem is that my concurrency field is on the base class table but I still want this behaviour on all derived entities.
Here is the code that I use:
<[If HasEntityField "ROWLOCKKEY"]>
<[If Not StringValueEquals CustomPropertyName "DoNotCreateConcurrencyPredicateFactory"]>
public <[ CurrentEntityName ]>Entity(System.Int32 iD, System.Int32 rowVersion):this(iD)
{
Fields[(int)<[ CurrentEntityName ]>FieldIndex.ROWLOCKKEY].ForcedCurrentValueWrite(rowVersion, rowVersion);
Fields.AcceptChanges();
IsNew = false;
}
<[EndIf]>
<[EndIf]>
The problem is that "HasEntityField" is not true while processing a subclass entity even though that entity will indeed have this field from its base class.
Can you suggest a way that I can test whether the base entity has the field? I just can't seem to figure out what combination of template elements to use to achieve this.