nunodg wrote:
Is possible to improve performance? How can I set DoNotPerformAddIfPresent = false for each Order collection created in Order property?
Nuno
Nuno,
Here's an excerpt from the LLBLGen User Manual.
How do I speed up manual bulk additions to EntityCollection objects using Adapter?
If you manually add entities to an EntityCollection object, using code generated with Adapter templates, you'll run into a performance penalty as the Add() method will check wether the entity added is already in the collection or not. This can lead to severe slowness in an application if the collection already holds a lot of entity objects (Add() uses List.Contains() which is a .NET method and which performs a linear search). To prevent this performance penalty, for example if you don't care if an entity object is added twice, you can set the EntityCollection property DoNotPerformAddIfPresent to false. When you do that, all Add() calls will skip checking if an entity is already in the collection and will be significant faster. FetchEntityCollection() always sets this property to false before fetching new entities in the collection. On SelfServicing no such property exist.
So, using your example:
EntityCollection customers = new EntityCollection(new CustomerEntityFactory());
IPrefetchPath2 prefetchPath = new PrefetchPath2((int)EntityType.CustomerEntity);
prefetchPath.Add(CustomerEntity.PrefetchPathOrder);
customers.DoNotPerformAddIfPresent = false;
adapter.FetchEntityCollection(customers, null, prefetchPath);
Should get you where you want to be.