Data Access has been discontinued. Please refer to this page for more information.

Explicit Mapping

This article is relevant to entity models that utilize the deprecated Visual Studio integration of Telerik Data Access. The current documentation of the Data Access framework is available here.

When you use default mapping, Telerik Data Access takes care of the property to column mapping. In other words, when you have a Model First Scenario and you use the default mapping functionality, Telerik Data Access will take care of the columns and table naming. The explicit mapping gives you more control over the columns\table naming. This topic deals with the explicit mapping functionality. For more information about default mapping, please refer to Using Default Mapping.

When you have a Database First Scenario, you could consider the reversed mapped domain classes as explicitly mapped.

Suppose, you are doing a model first mapping and you have the following domain model:

The Customer domain class is not mapped to a table. As you know from the Model First Scenario topic, when you save your domain model and take a look at the Error List pane, you should be presented with the following warning.

This warning is completely valid, and the information is absolutely correct. The warning is letting you know that the Customer item in the Visual Designer is not mapped to anything. The project will save and compile as-is, since this is a warning, but beyond having your conceptual model you really don't have anything substantial.

What you need to do in this case is to map your domain class (e.g. Customer) to a table. In order to do that:

  1. Select the domain class (in this example, the Customer entity).
  2. Open the Mapping Details Editor (View->Other Windows->Entity Diagrams Details Editor).
  3. In the Table Mappings section, check the Use Default Mapping option.

So far, you are repeating the same steps as in the Using Default Mapping topic. By using the Use Default Mapping option, Telerik Data Access automatically creates a table in the relational part of the model and maps all properties to columns. The specific moment here is that Telerik Data Access will give default names for the underlying table and columns.

To change the columns/table names:

  1. Right-click the domain class in Visual Designer and select Edit Table....

  2. This will open the Edit Table Dialog.

  3. Here, you could change the table and column names. For example:

  4. When all changes are done, click OK to submit the changes. Then, use the save command (Ctrl+S) to save your domain model.

What Just Happened?

When you add a new entity to your model, you need to map it to a table. By using the Use Default Mapping option, Telerik Data Access automatically creates a table in the relational part of the model and maps all properties to columns. At this point your domain model is in valid state. Telerik Data Access gives default names for the underlying table and columns. If you want to have a full control over the naming, then you need to resort to the explicit mapping feature. You could use the Edit Table dialog to change the names for the underlying table and columns, i.e. to specify the names explicitly.

Next Steps

The next step is to migrate your database schema to the latest model state. For this task, you will need to use the Update Database from Model wizard. Once you have mapped your entity to a table, you may ask yourself how to extend the domain class with new properties and map these properties to columns. For more information about this case, check out How to: Map New Properties to Columns.