Monday 25 November 2013

Meet the "DAR-th Vader" of Entity Framework which tries to Dynamically Load All Assemblies

This is done via the EDM.DefaultAssemblyResolver when executing GetAllDiscoverableAssemblies. The EDM.DefaultAssemblyResolver (aka the "DAR") can also be likened to the Gollum in Lord of the Rings, at least as far as assemblies are concerned, using an "inspect-only" bind.

Some other useful methods to know in this process:

EntityConnection->GetMetadataWorkspace; returns a "metadata workspace" (or MW). The MW is created when an EntityConnection is created. Metadata is then loaded into memory and used by the EDM application to access information about the underlying data source. When GetMetadataWorkspace is called, the metadata is "locked". The docs for System.Data.Objects say that the MW is not CLS-compliant so will likely not be compatible across .NET languages.

Unfortunately, this metadata workspace sometimes seems to contain irrelevant information for the purposes of data connection.

No comments: