For very large collections of dependent entities (> 10000) there is required significant time to access EntityCollection for the first time. The problem is most probably caused by multiple invocations of Contains method on List<T> Entities property in EntityCollection class.
The sample execution time for 32011 dependent entities is: 5907ms.
The solution for the problem might be to introduce additional HashSet which is synchronised with Entities and execute Contains method on it instead of List<T>.Contains.
The sample execution time for 32011 dependent entities is: 5907ms.
The solution for the problem might be to introduce additional HashSet which is synchronised with Entities and execute Contains method on it instead of List<T>.Contains.