---
title: "Entity Framework Core: Get a List of All the Tables"  
description: "Entity Framework Core: Get a List of All the Tables"  
author: "Utpal Vishwas"  
published: 2023-09-05  
updated: 2023-09-06  
canonical: https://www.mindstick.com/forum/159847/entity-framework-core-get-a-list-of-all-the-tables  
category: "asp.net core"  
tags: ["entity framework", "asp.net core", ".net core"]  
reading_time: 2 minutes  

---

# Entity Framework Core: Get a List of All the Tables

[Entity Framework](https://www.mindstick.com/articles/1566/crud-operations-using-entity-framework-code-first-approach) Core: Get a List of All the [Tables](https://www.mindstick.com/articles/336597/introduction-of-html-tables-for-web-development)

## Replies

### Reply by Aryan Kumar

You can get a list of all the tables in your [Entity](https://www.mindstick.com/forum/160562/database-connectivity-using-entity-framework-database-first-approach) [Framework](https://www.mindstick.com/forum/34615/software-framework-vs-library) Core database using the `Model` property of your DbContext class. The `Model` property is the collection of all the entities that are associated with the database.

The following code gets a list of all the tables in the database:

C#

```plaintext
var tables = context.Model.GetEntityTypes();
```

This code returns a collection of `EntityType` objects. Each `EntityType` object represents a table in the database.

Then you can traverse through the collection of `EntityType` object to get the names of the tables. For example, the following code prints the names of all the tables in the database:

C#

```plaintext
foreach (var table in tables)
{
    Console.WriteLine(table.Name);
}
```

Here are the few other things to keep in mind when getting a list of all the tables in an Entity Framework Core database:

- You can use the `Where` operator to filter the query results.
- You can use the `OrderBy` operator sort the query results.
- You can use the `Take` and `Skip` operators to paginate the query results.


---

Original Source: https://www.mindstick.com/forum/159847/entity-framework-core-get-a-list-of-all-the-tables

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
