High-CH3(CH2)6CH3 - speed improvement re-write of MetadataCollection<T>

Most of our performance investigations during the development of Entity Framework 6 led to concluding that the performance of lookups on MetadataCollection<T> was suboptimal, in many cases composing 10% to 20% of the time spent during the execution of a test. Its implementation also led to functional bugs that were not easy to anticipate.

This re-write of MetadataCollection<T> is based on the following principles:
- Speed-optimize for the main case: lookup by name (case-sensitive).
 - whenever case-insensitive lookups are made, it's okay to not be super-fast.
 - whenever index lookups are made, behave as close to a List<T> as possible.
- Maintain functional equivalence with the previous implementation.

The re-write was done from scratch by copying the type signature of MetadataCollection<T> (public + internal methods) and providing a basic implementation following the principles stated above. In many cases the code of the methods remained the same as it was before the re-write. The resulting class has roughly half the amount of lines of code, is easier to read, easier to maintain, remains functionally compatible and most importantly: is faster.

As an example of the improvement perceived: materializing 31465 SalesOrderHeader entities from AdventureWorks went from 5673 milliseconds to 4602 milliseconds (median value of 10 runs, release build, high-performance power setting, Windows 8.1 64-bit, .NET 4.5.2, Intel Xeon W3530 @ 2.8GHz). This represents almost a 20% improvement.

All tests passing 100%.
CodePlex #1837: CQT with a LOJ under a Filter is not being processed correctly.
Added code to detect in the initial Transformations phase of PlanCompiler if a LeftOuter join can be promoted to Inner join,
and forced rerunning the post JoinElimination transformations in that case, thus giving the JoinElimination phase the chance
to eliminate redundant joins before the join promotion.
Commit failure workaround polishing:

Renamed DbConfiguration.SetTransactionHandler to SetDefaultTransactionHandler
Reordered SetTransactionHandler parameters
Removed TransactionContext service, instead it will be passed directly to CommitFailureHandler in the constructor.
Renamed the dafault table name from __Transactions to __TransactionHistory
Renamed PruneTransactionRows[Async] to PruneTransactionHistory[Async]
Added ClearTransactionHistory[Async] to delete everything
Added static methods CommitFailuresHandler.FromContext
Removed StoreKey and used ExecutionStrategyKey instead

Workitem:1926
Issue 1817 - adding a property to define an input directory for frozen runtime packages
IdentitySplit - Fixing an issue in EmptyModel CodeFirst where we wouldn't allow creating MyModel.cs file if MyModel.edmx file already existed.
Reverting an incorrect old bugfix where HasMaxLength sets the IsUnicode default value. Now we get the correct default value from the provider manifest.

Workitem: 1665
MonoUriFix
Fix for issue https://entityframework.codeplex.com/workitem/1632
Making Dispose log messages more consistent.

Since we sometimes don't call Close/Rollback before calling Dispose it will now be logged too, but only if the former haven't been called already.
x + 1 - 0 != x (1159: ObjectContext.EnsureConnection() could cause a connection leak)

From bug:
The delegate passed to EnsureContextIsEnlistedInCurrentTransaction increases the connectionRequestCount, but this isn't correct as no additional requests were made and therefore there won't be and additional call to ReleaseConnection in that case resulting in the connection not being closed.

Fix:
Stop increasing the connectionRequestCount here.
Dumb package for sharp people... (891: NuGet Package install fails with F# projects)

Solution is to check that the VS project has a CodeModel (which F# doesn't, but we use when doing app.config/references stuff) and if not then allow the package to install without trying to do any app.config/references stuff.
     Equality not expaned correctly when both arguments are nullable and the expression is negated

     Replaced And(n, Not(Or(IsNull(Clone(x)), IsNull(Clone(y))))) with And(n, NotXor(Clone(x), Clone(y))). XOR is implemented using CASE statements.
     Updated tests and add missing case with both arguments being nullable.
AllVersionsOfEFAreEqualButSomeAreMoreEqualThanOthers - blocking OneEF if a project is using a non-EF6 version of EF

Also fixing a bug where double click on the Empty Model CodeFirst icon asserted and did nothing. Instead it is now acting as if the Finish buton was pressed if it was enabled.
1942 - Insert Coin

Issue #1942 - replacing string resources to make it clearer that an app needs to be built before adding a new model.
Partial fix for #1898 "Children could not be evaluated" when enumerating Results View in debugger

As explained in the MSDN documentation at http://msdn.microsoft.com/en-us/library/z4ecfxd9.aspx, when the debugger evaluates an expression in break mode (e.g. a property added to the watch window or the results of the methods printed in the immediate window) all but the current thread of execution are frozen.
Lazy<T>.Value calls Debuger.NotifyOfCrossThreadDependency() which tells the debugger that other threads might need to run temporarily in order to perform the evaluation correctly. If other threads are run temporarily that may have unexpected effects on the state of the program and for that reason the debugger will by default abort evaluation at that point.

The main goal of this change is to remove the use of Lazy<T> in LazyEnumerator<T> to reduce the chances of the debugger aborting evaluation, effectively re-enabling the visualization of query results while debugging (e.g. in the watch or the immediate windows).

Note that with this fix is only partial: if a retrying execution strategy is being used the bug will still repro.

In addition to the fix I have made a few simplifying refactorings around LazyEnumerable<T> usage and the corresponding changes to LazyAsyncEnumerable<T>, as well as a couple of code cleanups.
Typo in GetCaseSensitiveDictionary caused the dictionary to be recreated on every call. Made GetCaseSensitiveDictionary and GetCaseInsensitiveDictionary internal and added unit test.
     This also uncovered another issue. To optimize, the previous checking replaced calls to InvalidateDictionary with HandleIdentityChange when the name of an entity is updated. HandleIdentityChange updates the dictionary by removing the old entry and adding a new one instead of invalidating the whole dictionary. However there is some "interesting" code around FunctionParameter and configuring modification function mapping, where the parameter can be disconnected from parent (function), renamed, then reconnected. This causes the list and dictionary from the metadata collection of parameters to get out of sync. For that case kept the InvalidateCache call.
adding more null semantics tests
我们 speak wieloma Fremdsprachen.

Enabling localization of code items added to the project for Empty Model Code First.
UpToII

Adding support for the new Canonical Functions introduced in EF4
Codeplex issue http://entityframework.codeplex.com/workitem/1962
NewFamilyMember - Adding CodeFirstFromDatabase option to the start page of the wizard.