Greetings,
I have an entity "ApplicationEntity" with an optional 1-1 relation (with accessor) on another entity "RoommateGroupEntity". The RoommateGroupEntity has a 1-n relation on Roommates and a collection accessor for this relation. For data binding needs, I need direct access to the Roommates collection from the ApplicationEntity. So I added a custom accessor on ApplicationEntity like this:
public RoommatesCollection Roommates
{
get
{
if (this.RoommateGroup == null)
return null;
return this.RoommateGroup.Roommates;
}
}
However, when I load the applications and roommates like this:
applicationsCollection1.Clear();
IPrefetchPath prefetchPath = new PrefetchPath((int)EntityType.ApplicationsEntity);
prefetchPath.Add(ApplicationsEntity.PrefetchPathRoommateGroup).SubPath.Add(RoommateGroupsEntity.PrefetchPathRoommates);
applicationsCollection1.GetMulti(ApplicationsFields.TermId == termControl1.EditValue, prefetchPath);
gridView1.RefreshData();
gridView1.BestFitColumns();
If I break after the GetMulti call, the applicationsCollection1.Roommates is not populated for some data that has roommates and the applicationsCollection1.RoommateGroup accessor is a blank (new record).
However, if I set a break point within the Roommates accessor, I can see that the data is correct at the time the accessor is called. Somewhere inside the GetMulti call, but after my custom accessor is called, the data in the objects is being lost.
This isn't true for all elements int eh Applications collection I'm working with, but it is consistently true for a group of elements.
Any idea what might cause this or how to resolve it?