To add an entity definition, it depends on how you want to work: you can reverse engineer your entity definition from relational model data (Database First) or define it manually (Model First)
Right clicking on a catalog name or a schema in the Catalog Explorer, presents a context menu where you can choose either 'Reverse-engineer Tables to Entity Definitions' or 'Reverse-engineer Views to Entity Definitions', which will bring up the Reverse-engineering Element Editor. This editor can also be chosen by right clicking a specific table or view or a selection of tables or views.
If you want to map an entity onto the resultset of a Table Valued Function, you have to create a call to the Table Valued Function and select the existing entity as return type. Entities mapped onto Table Valued Functions always need to be mapped onto a table or view.
For model first you have several options to choose from:
- In the Project Explorer, right click the 'Entities' node and select 'New entity...' from the context menu, which will pre-select the group the 'Entities' node is in.
In the Project Explorer, make
sure 'Entities' is selected and press
Ctrl-E, which will pre-select the group the 'Entities' node is in.
Ctrl-Shift-Eto bring up the New Entity editor, no group is pre-selected
- Select Project -> New -> Entity from the main menu. No group is preselected.
- Click the button in the toolbar
- Use Quick Model to specify entity definitions by typing names or relationship declarations.
Right-click an entity in the Project Explorer and select
Edit... from the context menu. You can also press
or more selected entity definitions in the Project Explorer. This will
bring up the Entity Editor.
Another way to edit an entity definition is through Quick Model.
The designer also offers a General Entity Editor. This is a special kind of entity editor which allows you to edit the entity which is currently selected in the project explorer. This editor is opened by selecting Project -> General Entity Editor in the menu, or by clicking the button in the toolbar. The advantage of the General Entity Editor is that it keeps the current sub tab selected when you select another entity in the project explorer, which allows you to e.g. edit the mappings of several entities without a lot of clicking through tabs.