Skip to content

View Editor

Simon Mourier edited this page Feb 19, 2020 · 1 revision

The View Editor is accessible using the entity Ribbon Bar or the design surface context menu. When you click on “Add View”, you will be presented a resizable dialog box like this one:

View Editor - Picture 82

The dialog box helps you create a model view (which can be different than a resulting persistence view depending on producers / generators involved in the project):

  • A view is a sub-concept of an entity

  • A view must have a name.

  • A view has properties. These properties are listed in the dialog box. Properties can be directly associated with the parent entity properties (the properties with a left checkbox) or they can be declared ad-hoc using computing expressions.

  • From a view, the CodeModeler inference engine can infer a lightweight entity. This can be configured using the checkbox in the upper right of the dialog box.

By default, the list of properties are the parent entity properties (some properties cannot be used in a view, in this case, they would not even be proposed here). You can check any of the properties you need. In this example above, we created a view that only maps the “Id”, “EmailAddress” and “FullName” properties.

You can also add computed properties to the view when clicking on the “Add” button, as shown in the following image:

View Editor - Picture 83

Here, using auto-completion hints, we add a view property named “Country” with an “Address.Country” expression:

View Editor - Picture 84

It means the view will have a computed view property. If a persistence producer is added to the project and if this producer supports generating database persistent views, this computed property will probably become a join with the “Country” column of the “Address” table.

Note: Even if auto-completion prevents mistakes, there is no check in the Visual Studio design environment for computed view property expressions because these expressions cannot be validated at design time. They can only be validated at production time, or at runtime depending on the nature of the output.

Clone this wiki locally