Skip to content

Services

anton-martyniuk edited this page Sep 16, 2022 · 5 revisions

The following Modern generic services are available:

  • Service without Cache
  • Service with Cache
  • In Memory Service

Service with and without Cache implement IModernService<TEntityDto, TEntityDbo, TId> interface, which in order inherits from 2 interfaces: IModernQueryService<TEntityDto, TEntityDbo, TId> and IModernCrudService<TEntityDto, TId>.

IModernService<TEntityDto, TEntityDbo, TId> has 2 implementations:

  • public class ModernService<TEntityDto, TEntityDbo, TId, TRepository>
  • public class ModernCachedService<TEntityDto, TEntityDbo, TId>

1st is a regular service without cache, 2nd is a service with caching support.
The following methods of ModernCachedService return data from the cache: GetByIdAsync, TryGetByIdAsync.
Create, update, delete methods - add items into cache, update and delete them accordingly.

IModernQueryService provides methods to query data from the repository. IModernCrudService provides methods to insert, update, delete data in the repository.

In Memory Service implements IModernInMemoryService<TEntityDto, TEntityDbo, TId> interface, which in order inherits from 2 interfaces: IModernQueryInMemoryService<TEntityDto, TEntityDbo, TId> and IModernCrudInMemoryService<TEntityDto, TId>.

IModernQueryInMemoryService provides methods to query data from the in-memory cache. IModernCrudInMemoryService provides methods to insert, update, delete data in the repository and in in-memory cache.

IModernInMemoryService<TEntityDto, TEntityDbo, TId> has the following implementation:

  • public class ModernInMemoryService<TEntityDto, TEntityDbo, TId>
Clone this wiki locally