Haven't seen that yet. Tried it:
//stel een prefetch path in
IPrefetchPath prefetchPathOpdracht = new PrefetchPath((int)EntityType.OpdrachtEntity);
IPrefetchPathElement pfpeOpdrachtRegel = OpdrachtEntity.PrefetchPathOpdrachtRegel;
pfpeOpdrachtRegel.RetrievalCollection.EntityFactoryToUse = new Inova.FactoryClasses.BestellingRegelEntityFactory();
//stel een sortclause voor de opdrachtregels in
ISortExpression sorterOpdrachtRegels = new SortExpression(SortClauseFactory.Create(OpdrachtRegelFieldIndex.Volgnr, SortOperator.Ascending));
//zet opdrachtregelelement in prefetchpath
prefetchPathOpdracht.Add(pfpeOpdrachtRegel, 0, null, null, sorterOpdrachtRegels);
//stel een sortclause voor de opdracht in
ISortExpression sorterOpdracht = new SortExpression(SortClauseFactory.Create(OpdrachtFieldIndex.OrderNr, SortOperator.Descending));
//roep getmulti aan
opdrachtCollection.GetMulti(m_filter, 0, sorterOpdracht, relationsToUse, prefetchPathOpdracht);
m_filter en relationsToUse are set earlier in the code.
The collections are bounded to datagrids (or visaversa).
When I run the code, the first master-record has duplicate child-records and the rest of the master-record does not.
If I replace:
new Inova.FactoryClasses.BestellingRegelEntityFactory();
with:
new Inova.FactoryClasses.OpdrachtRegelEntityFactory();
which is the base entityfactory of BestellingRegelEntityFactory,
all is OK.
Could it be an error in the derived entityfactory?
/// <summary>
/// Factory to create new, empty BestellingRegelEntity objects.
/// </summary>
[Serializable]
public class BestellingRegelEntityFactory : OpdrachtRegelEntityFactory
{
/// <summary>
/// Creates a new, empty BestellingEntity object.
/// </summary>
/// <returns>A new, empty BestellingEntity object.</returns>
public override IEntity Create()
{
IEntity toReturn = new BestellingRegelEntity();
return toReturn;
}
}
Please help!
Zaad