Project Description
LINQ to EDMX makes it easier for .NET developers to access metadata in an Entity Framework .edmx file at runtime using LINQ.

Get Started
To get started, build the solution using Visual Studio 2010, then in your project reference:
  • LinqToEdmx.Core
  • Xml.Schema.Linq
No configuration is required.

To load an .edmx file and start querying it, call the static method Edmx.Load(<metadata file locations>). A strongly-typed, queryable representation of the .edmx file is returned.

See the unit tests for usage examples.

Metadata File Locations
The metadata file locations parameter in Edmx.Load(<metadata file locations>) follows the same rules specified in Model and Mapping File Locations.
  • The following example loads the Northwind .edmx file from the specified path:

  • The following example loads the Northwind .csdl, .ssdl and .msl files from the default directory of the running application:

  • The following example loads all .csdl, .ssdl, and .msl embedded resources from the calling assembly, referenced assemblies, and other assemblies in the bin directory of an application:

  • The following example loads the Northwind .csdl embedded resource from the LinqToEdmx.Test assembly:


I wrote this code because the Entity Framework does not expose the mapping model (DataSpace.CSSpace) via the MetadataWorkspace class. As a starting point, I leveraged the code generated by LINQ to XSD and am cleaning it up and adding functionality. LINQ to EDMX supports .edmx files that target .NET Framework version 4 (in other words, .edmx files based on the schema Microsoft.Data.Entity.Design.Edmx_2.xsd).

Want to add functionality? Please join the project!

Last edited Mar 9, 2010 at 9:29 PM by rbeauchamp, version 52