public TResult ExecuteQuery <TSearch, TResult>( IQuery <TSearch, TResult> query, TSearch search) { _logger.Log(query, search); return(query.Execute(search)); }
public void ExecuteCommand <TRequest>(ICommand <TRequest> command, TRequest request) { logger.Log(command, actor, request); if (!actor.AllowedUseCases.Contains(command.Id)) { throw new UnauthorizedUseCaseException(command, actor); } command.Execute(request); }
public TResult ExecuteRequest <TSearch, TResult>(IQuery <TSearch, TResult> query, TSearch search) { logger.Log(query, actor, search); if (!actor.DozvoleZaKorisnika.Contains(query.Id)) { throw new NotAutorizedUseCaseException(query, actor); } return(query.Execute(search)); }
public TResult ExecuteQuery <TSearch, TResult>(IQuery <TSearch, TResult> query, TSearch search) { _logger.Log(query, _actor, search); if (!_actor.AllowedUseCases.Contains(query.Id)) { throw new UnauthorizedUseCaseException(query, _actor); } return(query.Execute(search)); }
public TResult ExecuteQuery <TRequest, TResult>(IQuery <TRequest, TResult> query, TRequest search) { if (!actor.AllowedUseCases.Contains(query.Id)) { logger.Log(query, actor, false); throw new EntityNotAllowedException("You're not allowed to perform this action."); } logger.Log(query, actor, true); return(query.Execute(search)); }
public TResult ExecuteQuery <TSearch, TResult>(IQuery <TSearch, TResult> query, TSearch search) { logger.Log(query, actor, search); if (!actor.Permissions.Contains(query.Name)) { throw new UnauthorizedException(query, actor); } return(query.Execute(search)); }
public void ExecuteCommand <TRequest>(ICommand <TRequest> command, TRequest data) { _logger.Log(command, _actor, data); if (!_actor.AllowedUseCases.Contains(command.Id)) { throw new UnauthorizedUseCaseException(command, _actor); } command.Execute(data); }
public void ExecuteCommand <TRequest>(ICommand <TRequest> command, TRequest request) { //Console.WriteLine($"{DateTime.Now}: {_actor.Identity} is trying to execute {command.Name} using data:" + // $"{JsonConvert.SerializeObject(request)}"); _logger.Log(command, _actor, request); if (!_actor.AllowedUseCases.Contains(command.Id)) { throw new UnauthorizedUseCaseException(command, _actor); } command.Execute(request); }
//Prilikom izvrsavanje upita mozemo da definisemo preprocessing i postprocessing public TResult ExecuteQuery <TSearch, TResult>(IQuery <TSearch, TResult> query, TSearch search) { //1. Ispisivanje poruke ko je i koju komandu izvrsio (preprocessing) //query parametar kao IUseCase zato sto ga nasledjuje logger.Log(query, actor, search); if (!actor.AllowedUseCases.Contains(query.Id)) { throw new UnauthorizedException(query, actor); } return(query.Execute(search)); }
public void ExecuteCommand <TRequest>( ICommand <TRequest> command, TRequest request) { Console.WriteLine($"{DateTime.Now}, {command.Name} using data: " + $"{JsonConvert.SerializeObject(request)}"); logger.Log(command, actor, request); if (!actor.UseCases.Contains(command.Id)) { throw new UnauthorizedUseCaseException(command, actor); } command.Execute(request); }