By admin / 11-Feb-2022 / in Blog, Microsoft Entity Framework / 438 Comments / 37 Likes / Share This Post

In this Video, I am going to discuss the Model Browser in Entity Framework Database First Approach in detail. Please watch our previous Video where we discussed the Entity Data Model (EDM) in detail.

Note: We are going to work with the same example that we created in our introduction to the Entity Framework Database First Approach Video. Please watch our introduction to Entity Framework Database First Video before proceeding to this Video.

Model Browser in Entity Framework

The visual designer of the Entity Data Model does not display all the objects it creates. It only displays entities that are mapped to the database tables and views. As we know, we have created some stored procedures in our database. And while creating the Entity Data Model we have included those stored procedures as well. But if you look at the visual designer of the Entity Data Model, then you will not find those stored procedures as shown in the below image.

The Model Browser in Entity Framework gives you the information about all the objects and functions (stored procedures are created as functions) EDM has created.

What is the Model Browser in Entity Framework?

The Model Browser in Entity Framework is a Visual Studio tool that is integrated with the ADO.NET Entity Data Model Designer (Entity Designer). It provides conceptual and storage models tree view that is defined in a .edmx file. The Model Browser groups information into two nodes.

  1. The First node shows the conceptual model. By expanding the child nodes, you can view all entity types and associations in the model.
  2. The Second node shows the target database model. By expanding the child nodes, you can see which parts of the database tables, views, and stored procedures have been imported to the model.

Model Browser in Entity Framework gives all the information about all the objects and functions created by the EDM. In order to open the Model Browser, right-click the empty surface of the EDM designer and select Model Browser from the context menu as shown in the below image.

The Model Browser will appear in the area where you normally find Solution Explorer and Properties. The Entity Framework Model Browser contains all the information about the EDM, its conceptual model, storage model, and mapping information, as shown in the below image.

As you can see in the above image, the Model Browser contains the following objects:

  1. Diagrams: The Model Browser contains the visual diagrams of the EDM. You can see the default visual diagram created by EDM i.e. Diagram1. It is also possible to create multiple Visual diagrams for one EDM if the application has a large number of entities
  2. Entity Types: The Entity Types list all the class types which are mapped to the database tables.
  3. Complex Types: Complex types are the classes that are generated by EDM to contain the result of stored procedures, table-valued functions, etc. These complex types are customized classes for different purposes.
  4. Enum Types: Enum Types lists all the entities which are used as Enum in the entity framework.
  5. Associations: Associations lists all foreign key relationship between the entity types.
  6. Function Imports: Function Imports lists all the functions which will be mapped to stored procedures, table-valued functions, etc. Stored procedures and table-valued functions will be used as functions and not as entities in EF.
  7. EF_Demo_DBModel.Store: It represents the database schema (SSDL) i.e. the database tables, views, functions, stored procedures, and the foreign key relationships between the tables. If you expand the child nodes you will see the following.

READ MORE

SEE ALL

COMMENTS (438 COMMENTS)

SUBMIT YOUR COMMENT

SEND COMMENT

SEE ALL POSTS

RELATED POSTS

Microsoft Entity Framework / Blog

What is the Entity Framework?

Entity Framework is an Open-Source Object-Relational Mapping (ORM) Framework for .NET applications that enables .NET developers to work with relational data using domain-specific objects without focusing on the underlying database tables and columns where actually the data is stored. That means the Entity Framework eliminates the need for writing the data-access code that developers usually need to write.

11-Feb-2022 /37 /438

Microsoft Entity Framework / Blog

What is Entity Framework Architecture?

In this article, I am going to discuss the Entity Framework Architecture in Detail. Please read our previous article where we discussed the Overview of the Entity Framework. At the end of this article, you will understand the following pointers in detail.

11-Feb-2022 /37 /438

Microsoft Entity Framework / Blog

What is Context Class in Entity Framework?

In this article, I am going to discuss the Entity Framework Context Class with an example. Please read our previous article where we discussed the Architecture of Entity Framework in Detail. At the end of this article, you will understand what exactly the Context Class is and when and how to use this Context Class in Entity Framework with an example.

11-Feb-2022 /37 /438

--

--

Connektteacher

Welcome to Connekt Teacher Digital Library. Free Online Tutorials and Courses. The Complete Developer Course 2022 Videos.