public override async Task <TPageResponse> ExecuteAsync( PageCall <TPageGet, TMessage, TMessageResponse, TPageResponse> message) { var page = await executeHandler.ExecuteAsync(message.PageMessage); var fieldInfo = page.GetType().GetField(message.MemberName); var pageCall = (PageCall <TPageGet, TMessage, TMessageResponse, TPageResponse>)fieldInfo.InvokeGetter(page); var messageResponse = await executeHandler.ExecuteAsync(message.Message); return(pageCall.Translate(message.Message, messageResponse)); }
protected void Create <TMessage, TMessageResponse, TCallResponse>( Expression <Func <TPage, PageCall <TQuery, TMessage, TMessageResponse, TCallResponse> > > expression, TMessage message, Func <TMessageResponse, TCallResponse> translate ) { var body = (MemberExpression)expression.Body; var memberInfo = body.Member; var pageCall = new PageCall <TQuery, TMessage, TMessageResponse, TCallResponse>(); pageCall.PageMessage = this.currentMessage; pageCall.MemberName = memberInfo.Name; pageCall.Message = message; pageCall.Translate = (m, r) => translate(r); memberInfo.InvokeSetter(Page, pageCall); }