EF Core 1.1

Looking at your model in the debugger

As developers on the EF team it is often useful to see what is in the metadata model. To facilitate this, the model and all other metadata elements are able to generate a "debug view" which provides lots of useful information about the metadata in a terse but human-readable form.

Getting at it

In the debugger, expand context -> Model -> DebugView -> View.

EF Core model debug view

(The additional level of indirection from DebugView to View is intentional. For very large models it can be expensive to build the debug view string, which in turn can cause perf issues in the debugger. The indirection prevents the debugger from building the string unless it is requested by expanding the DebugView property.)

What it looks like

Here's the output for the model I was using while writing the post on notification entities:

Model: 
  EntityType: Blog ChangeTrackingStrategy.ChangingAndChangedNotificationsWithOriginalValues
    Properties: 
      Id (_id, int) Required PK ReadOnlyAfterSave RequiresValueGenerator ValueGenerated.OnAdd 0 0 0 -1 0
      Title (_title, string) 1 1 -1 -1 -1
    Navigations: 
      Posts (<Posts>k__BackingField, ICollection<Post>) Collection ToDependent Post Inverse: Blog 0 -1 -1 -1 -1
    Keys: 
      Id PK
    Annotations: 
      Relational:TableName: Blogs
  EntityType: Post
    Properties: 
      Id (int) Required PK ReadOnlyAfterSave RequiresValueGenerator ValueGenerated.OnAdd 0 0 0 -1 0
      BlogId (int) Required FK Index 1 1 1 -1 1
      Title (string) 2 2 -1 -1 -1
    Navigations: 
      Blog (<Blog>k__BackingField, Blog) ToPrincipal Blog Inverse: Posts 0 -1 2 -1 -1
    Keys: 
      Id PK
    Foreign keys: 
      BlogId -> Blog.Id ToDependent: Posts ToPrincipal: Blog
    Annotations: 
      Relational:TableName: Posts
Annotations: 
  ProductVersion: 1.1.0-preview1-22509
  SqlServer:ValueGenerationStrategy: IdentityColumn

Things to notice:

Hopefully this will help with understanding of the EF model and make it easier to find any issues. If you end up filing a bug against EF, then consider including this view with your issue.


This page is up-to-date as of November 17th, 2016. Some things change. Some things stay the same. Use your noggin.