2. BaseEntities

1. Introduction

A BaseEntity is a part of the configuration that contains all the information to read data from, or write data to a specific datasource. That datasource could be a table or view from a database, or a topic from a webservice to name a few examples. Each BaseEntity holds the configuration to one single datasource. In other words, in the case of a database connection, the BaseEntity reads/writes one table or view only. Joining multiple tables and/or views is not done on this level. This is done on the BusinessEntity level.

Basically, the BaseEntity thus points to one table, view, topic et cetera. It also contains which fields or properties should be read. Each property can be configured separately which is described in detail in this chapter. 

Furthermore, the relationship between BaseEntities can be used for validation upon deletion. By specifying these relations, the Essence Portal checks if there are corresponding records, and deletes or updates these records accordingly. Example; if you don't want it to be possible a Customer is deleted from the database if there are Sales Orders present, you need to specify the relation between the Customers and SalesOrders table.

The BaseEntity itself supports all the CRUD methods: Create, Retrieve, Update and Delete. But only those methods that are allowed by the datasource can be applied. Especially when working with webservices, it should be checked if creating, modifying or deleting data is allowed. With databases, updating or deleting data should only be done if you have sufficient knowledge about that database. Also, keep in mind that warranty may be void if data manipulation is done directly on the database. If a webservice or other validated mechanism is available, always go for that option

2. Creating a BaseEntity

To create a BaseEntity, open the Silver Editor and go to Mapping, Domains. From the list of available domains, select the domain from which you want to read the data. The list of available Domain Topics will then be built for that Domain. The icons in that list show the following cases:

Domain Topics: Already in the Silver Repository
In this screenshot, the Tobias Database is selected. The Domain Topic (in this case a table) Checks is selected. The Check Icon shows that this table is already present in the Silver Essence Repository.

Domain Topics: Not in Silver Repository
In this screenshot, the Domain Topic (in this case a table) RiskTypes is selected. The Plus and Processing Icons are visible which indicates this table is not yet present in the Silver Essence Repository.

Insert the complete Domain Topic

By clicking the Processing icon on the right, the BaseEntity will be inserted in the Silver Essence Repository, including all the properties.This is shown in the list of properties on the right:

BaseEntity: Insert including all properties

If you do not need all properties, you can instead click the Plus Icon and add just the Properties which are to be used in your solution:

BaseEntity: Inserted without the Properties

In both cases, the BaseEntity created is shown above the list of properties. By default, the name of the Domain Topic is used for the BaseEntity. You can change the name by clicking the Edit Icon.

BaseEntity: Changing the name

Frequently Asked Questions:
  • Why wouldn't I add all the properties to the BaseEntity?
    There are two reasons you might want to choose for adding just a selection of properties to the BaseEntity. First reason is the performance. All data that is to be read, must at some point be cached in memory. The configuration also needs to be evaluated. If a table or webservice topic has many properties which you do not plan to use, you can improve performance by not including those you don't need.

    Second reason is security. Properties you do not include in the BaseEntity, are not available in the Silver Essence Portal, nor in the Silver Essence Webservice. Especially if there is sensitive data in the table which you do not plan to use in your solution, you should play it safe and simply not include the property.
  • Is it possible to add properties to the BaseEntity later?
    Adding properties can always be done. This can either be if you decide to expand your solution and additional properties are required. Or it can be because the database model has changed and you need to update your solution accordingly. Adding properties later is done in the same way as when you create the BaseEntity.
  • What naming should be used?
    Basically the name of the Domain Topic is used, but you can change this to any name providing it is unique in the configuration. When going up in the configuration, the name you choose here will be used by default. So it might even show up in the User Interface. So, it's best to choose a logical and recognizable name.

    Also, higher up in the configuration we will distinguish between BusinessEntities and BusinessEntityLists. Although it is by no means mandatory, it is best to use Singular names for BaseEntities and BusinessEntities. And use Plural names for the BusinessEntityLists. Example; Use the name Customer for the BaseEntity and BusinessEntity, Customers for the BusinessEntityList. In the end it will improve the readability of your configuration.

3. Configuring the BaseEntity

Once you have created the BaseEntity and added the properties, you can now continue to configure it. To do this, go to the Mapping, BaseEntities tab. The BaseEntity created will be shown in the list and is by default selected. The QuickEditor panel is expanded by default so you can start editing your newly created BaseEntity right away.

Silver Editor: BaseEntity QuickEditor