In order to apply the Manual Mapping procedure, let's refer to the "CRM" dataservice project in which we have a Domain Model containing the "Company" and the "Purchase" classes properly mapped and the unmapped "Employee" class.
The Domain Model also contains the "CRM" database connected with an existing physical database. In WebRatio Platform it's always possible to manually define the mapping for elements in the Domain Model.
The "Manual Mapping" method is useful when you need to map items created in the database to already existing Domain Model items. To manually map an element you must be connected to the database.
We want to map the "Employee" class to the existing table on the database. As you can see, the "Employee" class is unmapped. Select the "Employee" class nad move to the Properties View and select the "Mapping" tab.
Let's start mapping the "Employee" class to the corresponding table in the database. In the "Mapping" tab you can find and change all the information related to the item mapping, such as the Database, the Schema, Table, and so on. Press the "Select" button next to the "Database" property. In the opening dialog, select the "CRM" database and press the "OK" button.
Now let's define the "Schema" and the "Table" properties. In this case, WebRatio Mobile Platform automatically fill in the "Schema" property with the default schema defined in the project for the "CRM" database. Click on the drop-down menu next to the "Table" property and choose the "employee" table from the list containing all the table in the database.
Now let's map all the attributes in the "Employee" class to the corresponding columns in the "employee" database table. Select the "oid" attribute and move to "Mapping" tab in the Properties View. As you can notice, WebRatio Platform automatically set the "Schema" and "Table" properties. Their values are inherited, indeed, from the corresponding properties in the class mapping. In the "Mapping" tab of the Properties View, click on the drop-down menu next to the "Column" property. Choose the "oid" column from the list containing all the columns in the "employee" table. Then map the "First Name" attribute to the "first_name" column, the "Last Name" attribute to the "last_name" column, the "Birth Date" attribute to the "birth_date" column and the "Role" attribute to the "role" column.
Once the Manual Mapping operation is completed, you can see that all the question marks have been removed.