After upgrading to V2.0 I get duplicated entities using this prefecth path:
Example Tables:
Master Table have 1 record
Master Table
MasterId
1
Detail Table have 2 records
Detail Table
DetailId MasterId
1 1
2 1
After executing this code,
IPrefetchPath2 path2 = new PrefetchPath2((int) EntityType.DetailEntity);
path2.Add(DetailEntity.PrefetchPathMaster).SubPath.
Add(MasterEntity.PrefetchPathDetail);
DetailEntity entity = new DetailEntity(1);
adapter.FetchEntity(entity, path2);
the collection entity.Master.Detail returns the following 3 records
DetailId MasterId
1 1
1 1
2 1
It should return only 2 records.
If I edit the file MasterEntity.cs and add DoNotPerformAddIfPresent = true after creating the collection,
public virtual EntityCollection<DetailEntity> Detail
{
...
_detail = new EntityCollection<DetailEntity>(new DetailEntityFactory());
_detail.DoNotPerformAddIfPresent = true;
...
}
the problem disappear, but I don't think this is a solution.
How can I fix this?
Thanks,
Nuno