问题
First of all, I have no idea if this is possible! and I'm struggling to find an answer. I think I don't know what to search for!
I have an endpoint that returns IEnumerable
, I want to divide the response so I used
.Skip().Take()
Now when I get the first take, how can I get the second one without invoking the same endpoint!
The problem is IEnumerable
gets the data from another service where it is not possible to divide, so I have to get everything at once and then I have to call another "SLOW" endpoint that gives me 5 results at the time using what I got from the IEnumerable
.
So what I want to do is, divide the first list, do the second call, put the result together, return this and repeat until the list is completed.
Is there a way to keep angular listening for responses and append them as they arrive?
Or can I make another call after I get the result but without requesting the complete list again ? "save it somewhere!".
回答1:
The simple answer to what I was trying to achieve is NO it is not possible. The change has to be done on a deeper level (querying the DB).
Using static works but then this is a web application so that would be problematic so again its a NO.
I ended up getting the whole list, then looping through it one by one to get the slow data then show it to the user.
来源:https://stackoverflow.com/questions/52436049/one-call-main-multiple-responses-in-asp-net-mvc-angular-6