Up Refine in the EDM Designer

EDM Model Browser

Last modified on August 15, 2012 17:21

The EDM Designer's Model Browser window presents the conceptual entities and related database storage objects in a searchable tree view. The Model Browser is an easier way to navigate a large model than the EDM Designer canvas window.


The Model Browser is one of the EDM Designer windows.

When the EDM gets large, the number of items can overwhelm the EDM Designer canvas. The diagram becomes small and dense and it is too hard to find the entity or association that interests you.

The Model Browser affords a more manageable, alphabetically sorted view of the model. Unlike the canvas, it presents both the conceptual entity model and the related database storage model in a tree view.

The Model Browser does not display the mappings between the conceptual entities and the storage schema; for that you go to the EDM Mapping Details window.

Here's a Northwind-based EDM in the Model Browser with the conceptual entity types unfurled.

EdmDesignerModelBrowser.png

The top two nodes, Northwind and Northwind.Store, hold the conceptual model and store model definitions respectively.

The properties of the Northwind node define critical code generation characteristics and merit close attention on their own. 

The balance of this topic takes you on a brief tour of the Model Browser. See the Microsoft documentation for more detail.

Search

You can search in the Model Browser for an entity, property name, association, complex type, store object ... just about anything ... by entering some text in the search TextBox at the top. We look for "Company" in this screenshot:

EdmDesignerModelBrowserSearch.png

Notice it found "Company" in the name of a property of the Customer entity and in the name of a column in the "Customer" table.

Notice also the two red stripes on the window's scroll bar, indicating the approximate location of every mention of "Company". That's a valuable clue when trying to find something in a large model.

Context Menu

Right-mouse-click any object in the Model Browser to get a context menu that is specific to the object type. The entity object context menus look like this one; the store object context menu is shown below.

EdmDesignerModelBrowserContextMenuClass.png

Show in Designer is a particularly useful option because it takes you directly to the corresponding graphical object in the canvas. That's crucial because some EDM functions - such as delete - are only available on the canvas.

Table Mapping opens the Mapping Window and displays the mappings for the selected entity.

Stored Procedure Mapping opens the Mapping Window and displays the stored procedure mappings for the selected entity. DevForce can take advantage of Entity Framework support for entity stored procedures.

Update Model from Database... is how the Data-First developer adds and updates entities based on database schema. It launches the Update Model Wizard.

Generate Database from Model.. generates SQL scripts for creation of a database that matches the current conceptual model. This is useful for the Model-First developer; the Data-First developer can ignore it.

Validate checks the entire model and reports errors and warnings to the Visual Studio "Error Window". EDMX validation is covered in another topic.

Properties opens the designer's Properties Window for the selected object which could be an entity, association, complex type, storage object, or the model as a whole.

Conceptual model object properties

Each entity object has its own distinctive properties as depicted in these screenshots. Most of the properties are editable. Their meaning and values are discussed in the Properties Window topic.

Model

The model properties level, "Northwind" in this example, controls diagram appearance and code generation for the EDM as a whole.

EdmDesignerModelBrowserModelProperties.png

Entity property

EdmDesignerModelBrowserEntityProperties.png

Association

EdmDesignerModelBrowserAssocProperties.png

Storage objects

You can browse the store object to which the entities are mapped.

EdmDesignerModelBrowserStoreProperties.png

You can't change anything about the store objects; their properties are read-only.

Delete store object


You can drop a store table, view, or stored procedure from the Model Browser by selecting it and picking delete from the item's context menu as seen here.

EdmDesignerModelBrowserStoreContextMenu.png

This little known feature is the only way to drop a table from within the EDM Designer when there is no corresponding, mapped entity. Usually you delete the table when you delete the entity. But you can opt out and just delete the entity; the table definition remains behind, unmapped, in the storage section of the EDM. If you later decide that you don't want to map the table at all, this is the way to get rid of it.

You are only deleting the store object from the model, not from the database.

Tags: Model EDM
Created by DevForce on March 21, 2011 19:24

This wiki is licensed under a Creative Commons 2.0 license. XWiki Enterprise 3.2 - Documentation. Copyright © 2015 IdeaBlade