Problem description
I try to get a collection with a prefetch path, but the related entity is only set in some of the collection's elements.
It only happens when Target per entity hierarchy is used and a field of each derived entity (ex. int) is mapped to the same field in the database.
Maybe is this mapping not allowed?
Llblgen Pro v.3.5 August 8th, 2012
Example:
- Two entities DocumentEntity & FolderEntity
- Two derived entities DocEventEntity & FolderEventEntity (basetype: BaseEventEntity, abstract).
Target per entity hierarchy.
- DocEventEntity has a field IdDocument, mapped to the IdEntity field in the database. It is a FK to a DocumentEntity (navigator: Document)
- FolderEventEntity has a field IdFolder, mapped to the same IdEntity field in the database. It is a FK to a FolderEntity (navigator: Folder)
- BaseEventEntity has no field mapped to IdEntity
Now, I try...
PrefetchPath prefetchPath = new PrefetchPath(EntityType.FolderEventEntity);
prefetchPath.Add(FolderEventEntity.PrefetchPathFolder);
FolderEventCollection collection = new FolderEventCollection();
collection.GetMulti(null, prefetchPath);
FolderEventEntity ev = collection[0];
string folderName = ev.Folder.Nombre; // Folder is null!!!
... but the .Folder is only set in the last event with that folder (ex. event1, event2 & event3 point to folder1, then only event3.Folder is set)
Thanks in advance,
Jose