Skip to main content

Entity

Business objects that are used for data manipulations should be inherited from the Model classm but business objects that are stored in the database should be inherited from the Entity class. It uses normal properties, without Optional type. To store business objects in the database, as well as to retrieve them, the ORM Entity Framework Core is used. This library imposes certain rules on the structure of records and field names. Entity class doesn't contain any properties.The RecordStorageEntity is a base class for all business objects, that can be identified:

It has almost the same structure as RecordModel, but there are some differences according to EF Core requirements.

public Guid? CreatedByUserId { get; set; }

public UserEntity? CreatedByUser { get; set; }

public SeedRecordSnapshotStorageEntity? SeedRecordSnapshot { get; set; }

For entity references you have to add a special Id property, according to EF Core naming convention: CreatedByUser + Id.


ExistedRecordModel has corresponding ExistedRecordEntity: