How does the JavaScript Create-Update-Delete actually work?

雨燕双飞 提交于 2019-12-20 07:17:14

问题


Using MVC Template with jQuery ASP.Net Core 2.0

Taking the code below as an example, I'm unclear as to actually what or how this call is constructed and what path it takes (API or direct ref to app services).

snipped...

I do understand that the fetches from the Controllers are via the Application Services directly (not API calls) using the template in it's default state.

It's just the create/update/delete calls via the JavaScript that has me a slightly confused.


回答1:


It is an API call.

How it actually works...

From the documentation on Client Proxies:

ABP can automatically create JavaScript proxies for all MVC Controllers (not only application services). It's created for Application Services as Controllers by default. You can add the [RemoteService] attribute to any MVC controller to create a client proxy for it. JavaScript proxies are dynamically generated at runtime. You need to add a given script to your page:

<script src="~/AbpServiceProxies/GetAll?type=jquery" type="text/javascript"></script>

For the template, it's added in _Layout.cshtml.

If you're interested in the implementation, the proxies are created in JQueryProxyScriptGenerator.



来源:https://stackoverflow.com/questions/49204884/how-does-the-javascript-create-update-delete-actually-work

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