c# - Split an IObservable and then combine after processing? -


After experiment with IObservables, I decided to test them for the processing of messages sent just above a message.

Have done I have to do the necessary tasks to answer the and request response at one point during processing

; Request & gt; Essentially I get a IObservable & lt. Deserize the data and change it from a command object into a convertor object in which it actually has to do. Order is not related to the request.

After deserializing it, I have to change it in the proper response, although I need the original request object to send the feedback. While maintaining high code readability, I want to achieve and achieve it. So far, I've used expansion methods and lambda expressions to get the following (; Request & gt; where request IObservable & lt ):

  requestProcessor = requests .Deserialize & LT; IdentityRequest & gt; () .Where (idRequest => idRequest.Address = null!). Select (idRequest = & gt; New IdentityResponse () {identity = identityTable [idRequest.Address.Address]}) .Serialize () .ZIP (request , (Feedback, request) => new {request = request, feedback = response}. Subscription (data => data.request.Respond (data.response, ObjectTypes.IdentityResponse));  

My question is, because all the commands are processed before the zip function, the same code operates on zip If there is a continuous stream of messages (even on the original input, and on separate processed inputs)

It has been settled satisfactorily but a better method can be made as a monaedic, which are of two types: one value Programmed data to be converted; . And a reference that is the surrounding data

This is something like the following:

  public class ComposedType & LT; TValue, TContext & gt; {Receive {public TV price values}; Protected Set; } Public TContext Reference {get; Protected Set; } Public Compose Type (TV Price, TContext Reference) {value = value; Context = reference; }}  

I have also defined operators vested for both reference and value. There are also some associated extension methods that allow you to change the value in a new way.

If someone has a better way, though I welcome the option, and I'm going to leave it unanswered for a while.


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -