title: EF Core 3.1 to 5 Update -> IEntityType.GetTableName
body: <p>In EF Core 3.1 this was working</p>
  <pre><code>// Model
  builder.Entity&lt;MyEntity&gt;().HasNoKey().ToView(&quot;MyView&quot;, &quot;dbo&quot;);
  
  // Then I have this Function
  public static GetTableName&lt;T&gt;(this MyDbContext db)
  {
        var t = db.Model.FindEntityType(typeof(T));
        return t.GetTableName()
  }
  </code></pre>
  <p>In EF Core 5 <code>t.GetTableName()</code> returns <code>null</code> because the method supposed to be used is <code>t.GetViewName()</code></p>
  <p>so I changed my code to</p>
  <p><code>return t.GetTableName() ?? t.GetViewName()</code></p>
  <p>However I think its &quot;ugly&quot; and I would rather check if <code>t</code> is a view or a table and then call the right <code>t.Get[View/Tabe]Name</code>. But I didn't find any property or method on <code>t</code> itself to find out what it is.</p>
  <p>Any Ideas and how to find out if it's a view or a table?</p>