从ASP.NET MVC Boilerplate生成的Application Services dynamically API控制器。例如,我需要在请求进入action /方法之前抛出异常。如何处理请求?谢谢!
public class UserAppService : PlatformAppServiceBase, IUserAppService
{
private readonly IRepository<User, long> _userRepository;
public UserAppService(IRepository<User, long> userRepository)
{
_userRepository = userRepository;
}
// handle request before request executes this action
public async Task<ListResultOutput<UserDto>> GetUsers()
{
var users = await _userRepository.GetAllListAsync();
return new ListResultOutput<UserDto>(users.MapTo<List<UserDto>>());
}
}