April 2018
Intermediate to advanced
300 pages
7h 41m
English
The BaseEntity class contains common properties being used by all the domain models in our microservices projects. Usually, for all the transaction tables, we store CreatedBy, CreatedOn, UpdatedBy, and UpdatedOn fields. When designing the entity model for each service, we will inherit from the BaseEntity class so all these common properties will be added to the table when the migration is run. Here is the code snippet of the BaseEntity class:
public abstract class BaseEntity { public BaseEntity() { this.CreatedOn = DateTime.Now; this.UpdatedOn = DateTime.Now; this.State = (int)EntityState.New; } public string CreatedBy { get; set; } public DateTime CreatedOn { get; set; } public string UpdatedBy { get; set; } ...