In LINQ to SQL you can inspect the underlying meta-model of a data context via its Mapping property.
Is there an equivalent or close-enough pattern in EF Code First for inspecting or manipulating model configuration, given a DbContext instance?
I know you can use the Fluent API to configure the mappings up front, but I’m talking about general inspection of a model from outside code using an API, without needing to have object instances to work with (other than the DbContext, of course).
DbContextitself doesn’t provide access to meta model. You must convertDbContexttoObjectContextby using:After that you can access
objectContext.MetadataWorkspacebut the workspace itself was not designed for direct usage – API is highly unfriendly and it is read only.