Service Layer Pattern
What this page covers#
This page shows how MooDb can sit under an application service.
Example#
public sealed class UserService { private readonly UserRepository _repository; public UserService(UserRepository repository) { _repository = repository; } public async Task<User?> GetUserAsync(int userId) { return await _repository.GetByIdAsync(userId); } }
Why this can be useful#
This keeps business workflow code above database access code, while still keeping MooDb usage explicit and readable.