Hi,
I think there's a bug in the EntityFieldFactory.Create(string objectName, string fieldName) method. Things work just fine when I use this method for normal entities.
But today I struggled quite some hours to identify this "bug". I use inheritance (based on the discriminator column). At runtime I try to identify a field of an inherited entity, to use for my dynamic ConcurrencyPredicateFactory. (A timestamp field called Version).
The line of code I use is the following:
EntityField2 timestampField =
(EntityField2)EntityFieldFactory.Create(entity.GetType().Name, TIME_STAMP_FIELD_NAME)
Where TIME_STAMP_FIELD_NAME is a constant that holds the value "Version"
This line works just fine for alle normal entities or the base entity. But for the derived classed, this line of code produces the following error:
The field 'Version' isn't known in the element 'Em3xxEntity'
Parameternaam: elementFieldName
This means that in following example the first 2 would be ok, but the third one fails (because Em3xx is derived from Device)
EntityField2 timestampField = (EntityField2)EntityFieldFactory.Create("FuelEntity", "Version");
EntityField2 timestampField2 = (EntityField2)EntityFieldFactory.Create("Device", "Version");
EntityField2 timestampField3 = (EntityField2)EntityFieldFactory.Create("Em3xx", "Version");
This is the end of the stacktrace...
bij SD.LLBLGen.Pro.ORMSupportClasses.FieldInfoProviderBase.GetFieldInfo(String elementName, String elementFieldName)
bij EMGroup.Galantis.BL.Core.FactoryClasses.EntityFieldFactory.Create(String objectName, String fieldName) in
Can you please help me out for this one?
Kind regards,
TomV