-
Notifications
You must be signed in to change notification settings - Fork 5
3 Services
Emmanuel D edited this page Nov 9, 2020
·
1 revision
Services host business logic and interaction with repositories. Service is entity based.
Services are classes that inherit from BaseEntityService . By default, they have the following methods :
- GetByID, get the entity according his key
- QueryAsync, request the repository according your query. Will return full entity and children if using the include property.
- QueryWithProjectionAsync, request the repository and will map the result to another object. Request will be optimized for the mapping, getting only necessary fields.
- CreateAsync, create the entity
- UpdateAsync, update the whole entity
- UpdatePropertiesAsync, update some properties of the entity
- IsValid, check the entity against model validator. Raise an exception if validator is not found.
public class MyModelService : BaseEntityService<MyModel>, IMyModelService
{
}