-
Notifications
You must be signed in to change notification settings - Fork 12
Entity Framework
Alex Fox Gill edited this page May 11, 2016
·
10 revisions
ModelMetadata can be generated automatically from an EDMX file or a Code-First DbContext, using the LazyEntityGraph.EntityFramework library.
For each method, the MetadataWorkspace is retrieved using Entity Framework, and then processed to extract entity types and relationships. It is cached statically so that this process is only run once per test run.
To generate metadata from an EDMX, call ModelMetadataGenerator.LoadFromEdmxContext<TContext>(string contextName) (source). The contextName argument is the name of your EDMX model.
To generate metadata from a Code-First DbContext, call LoadFromCodeFirstContext<TContext>(Func<string, TContext> createFromConnectionString) (source)