Entity Service

Entity Service:

This was the first service I built, its a generic service to handle entity data access for any of the Entities in our multiple databases. This was required to start creating all the other applications (visual) that require data for different stake-holders to start seeing value in the MVP that we were going to build first.

The Service would expose endpoints like: GetEntity, GetEntities, SaveEntity, DeleteEntity etc. Because we were using Relational databases and a relational data model, we had a need to return connected data objects from a single query. So GetEntities here, would take in a search pattern to look for an entity in our database portfolio and return other Entities that are connected to the original entity searched.

Entity data connection diagram

The Entity Service had a few base layers:

  • IEntity: the base for any Entity model in the various databases.
  • Crypto: to handle reading and writing encrypted or hashed data into our datastore.
  • DataLoader: to handle the High-Availability for the multiple database servers we would have, and connection to the multiple databases.

Entity Service parts diagram

The Service itself has one simple task: Read/Write data from the correct database based on the entity name provided and return objects or status based on the endpoints invoked.

In order to do access the data, the Entity service goes through DataLoader to connect to the various databases to one of (N) database servers available for use. This information (what servers are available with what entity) is available surprisingly in the DataLoader database, which itself is directly connected to the Dataloader module using configuration values in a file. Link to dataloader Blog Post here.