问题
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