JavaScript Create-Update-Delete实际上如何工作? [英] How does the JavaScript Create-Update-Delete actually work?

查看:78
本文介绍了JavaScript Create-Update-Delete实际上如何工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在jQuery ASP.Net Core 2.0中使用MVC模板

Using MVC Template with jQuery ASP.Net Core 2.0

以下面的代码为例,我不清楚该调用的构造或方式以及构造方式(API或直接引用到应用程序服务).

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).

狙击...

要做,我了解使用默认状态下的模板,直接通过应用程序服务(而不是API调用)从控制器获取数据.

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.

只是通过JavaScript进行的create/update/delete调用,让我有些困惑.

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

推荐答案

这是一个API调用.

客户端代理:

ABP可以为所有MVC控制器(不仅是应用程序服务)自动创建JavaScript代理.默认情况下,它是为应用程序服务作为控制器创建的.您可以将[RemoteService]属性添加到任何MVC控制器以为其创建客户端代理. JavaScript代理是在运行时动态生成的.您需要在页面上添加给定脚本:

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.

这篇关于JavaScript Create-Update-Delete实际上如何工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆