One call main, multiple responses in ASP.NET MVC + angular 6

人走茶凉 提交于 2019-12-13 02:26:32

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!