FixupSpeedup episode one - the slowdown menace

Entity fixup is still costly but this changeset is making it 10x faster by getting some low hanging fruit:
  - Reduction of allocations by changing .ToArray() by .ToList() when the collection is temporary.
  - Caching of values that are used constantly.
  - Accessing the same property repeatedly inside loops avoided.

The caching will probably have to be revisited in a future iteration. Here are some of the numbers I obtained:

RelationshipFixup before the change
1153252ms total (100 iterations)
17920ms 95th percentile
20988ms 99th percentile
20988ms 99.9th percentile

RelationshipFixup after the change
138670ms total (100 iterations)
1652ms 95th percentile
1944ms 99th percentile
1944ms 99.9th percentile

The closest EF6 test we have is objectctx-fixup-fk-poco
13339ms total (100 iterations)
171.74ms 95th percentile
287.71ms 99th percentile
287.71ms 99.9th percentile
I'll evaluate the performance of your suggestion and take it accordingly. Thanks.