public IAsyncResult BeginProcessRequest(HttpContext context, AsyncCallback cb, object extraData) { Guid transactionId = CombGuid.Generate(); T actor = (T)Activator.CreateInstance(typeof(T), new[] { transactionId, context, cb, extraData }); _actorRepository.Add(actor); AsyncCallback callback = x => { _actorRepository.Remove(actor); context.Response.Write("Repository Size: " + _actorRepository.Count()); cb(x); }; IAsyncResult asyncResult = actor.BeginAction(context, callback, extraData); _bus.Endpoint.Send(new InitiateStockQuoteRequestImpl { RequestId = transactionId, Symbol = "AAPL" }); return(asyncResult); }
public ResultListDto <ActorDto> Handle(GetActorListQuery query) { var actors = _actorRepository.GetActors(query.Page, query.PageSize); var actorDtos = actors.Select(a => new ActorDto { Name = a.Name, Balance = a.Balance.Name, Experience = a.Experience, CurrentHealth = a.CurrentHealth, Health = a.Health, Power = a.Power, Speed = a.Speed, Quality = a.Quality.Name }).ToList(); return(new ResultListDto <ActorDto>(_actorRepository.Count(), actorDtos)); }