- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
有没有办法让 Breeze JS 在通信失败的情况下自动重试?理想情况下,我想添加一个基于响应的中央事件处理程序,例如 401 我可以提示用户重新登录,然后重试请求,或者如果其一般连接问题为用户提供重试或取消的选项?
我可以在每个请求位置添加代码来处理这个问题,但这将是大量工作,理想情况下这需要位于一个中心位置。
最佳答案
您可以将重试逻辑放在 request interceptor 中。
来自 Breeze 文档:
Stock Breeze AJAX adapters offer an extension point, the requestInterceptor. This interceptor gives the developer one last look at each request before the adapter calls the actual AJAX component.
The interceptor takes a single parameter, the requestInfo, and returns nothing.
var requestInfo = {
adapter: this, // this AJAX adapter
config: ..., // the configuration object passed to the wrapped AJAX component
dsaConfig: config, // the config arg from the calling Breeze DataServiceAdapter
success: successFn, // adapter's success callback
error: errorFn // adapter's error callback
}
您的请求拦截器可以包装 error
回调并添加重试逻辑和 401 处理。
如果您将 Breeze 与 jQuery 结合使用,您可以使用 jQuery 的 ajax prefilter 在较低级别执行此操作。 .
关于javascript - BreezeJS 中央错误处理程序和自动重试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28920506/
玩breezejs。这是一个代码: var dataService = new breeze.DataService({ serviceName: "/api/
我有一个搜索字段的文本输入,然后将字符串传递给 EntityQuery。当查询包含单引号时,我会收到如下消息: 在 'substringof(O'Malley,FirstName) eq true'
我有一个带有来自数据库的导航属性的模型。模型结构如下 public class Parent{ public string propertyone {get; set;} public ILi
假设我们有一个客户对象,它有一个“Foo”集合。我希望我的“getCustomer”函数添加它还没有的所有 Foos,然后返回它自己,作为一个 promise ... 所以我想要一个 promise
假设我们有一个“父”实体“客户”和一个子实体“订单”,并且我们在子实体的上下文中,我如何在不删除订单的情况下从客户“分离”订单?基本上我会在 SQL 中做的是: update Order set Cu
我有一个 custom context provider在服务器端验证。现在我想硬删除一个客户实体及其所有子实体(地址、电子邮件等) 客户 地址 电子邮件 ... 自定义上下文提供程序是否是检查和删除
有没有办法在 Breeze JS 中处理无模式的复杂属性? 我有一个用例,我需要存储特定于客户的查找表。这些查找表可以有任意数量的列和行。我的首选解决方案是将它们存储为以下形式的 JSON 对象: {
在 BreezeJS 中与数据库交互安全吗? 例如,如果我使用以下代码,它会直接在 JavaScript 中清楚地显示数据库名称、表和查询本身。它是否与数据库建立安全连接? var manager =
我很好奇 BreezeJS 如何确定实体的哪些属性已更改并且仍然支持 IE8? 我正在构建的库需要类似的功能。 JavaScript setter/getters 将是最简单的解决方案,但 IE8 中
有没有办法让 Breeze JS 在通信失败的情况下自动重试?理想情况下,我想添加一个基于响应的中央事件处理程序,例如 401 我可以提示用户重新登录,然后重试请求,或者如果其一般连接问题为用户提供重
如何使用 BreezeJS + OData 或 WebAPI 编写复杂查询?我希望能够在 JayData 中使用 Northwind 作为引用数据库做这样的事情?我的问题是我不知道如何表达同时引用数据
我有一个名为 Item 的类,它由 PeriodId 过滤。有很多时期——但我们一次只需要看一个。我想向用户展示初始数据加载(例如,PeriodId==1 的位置)。然后我希望用户能够查询/过滤其他时
如果我有一个包含两个数字列(例如 X 和 Y)的表,并且需要检索其中 X > Y 的行。如何使用 BreezeJS 实现此目的?到目前为止,我遇到的所有示例都只能将列与固定值进行比较。 编辑:我尝试使
给定任何 BreezeJs 实体,如何确定它与其导航属性的关系 - 即它是否具有 1 对 1、1 对 0 或 1、1 对 n 等关系? 最佳答案 使用getProperty检索属性的 info 。当是
我正在寻找一种编写 Breeze 实体查询的方法,该查询允许我获取由特定属性区分的前 10 个实体。 这个 LINQ 片段大致描述了我想要做的事情: repo.Foos() .GroupBy(
我是 BreezeJS 新手,想知道是否有任何有关如何将 Breeze 与 SQL 存储过程结合使用的示例? 我们有一些非常复杂的查询,并且希望能够通过 SP 调用它们。另外,我们如何告诉 Breez
我正在使用带有 Breeze 和 Angular 的 MVC 4。 我已经创建了一些域模型,我只想显示模型列表。这是我的代码: API Controller : [BreezeController]
背景:我正准备开始一个需要移动优先的项目。我在客户端使用 AngularJS,在数据库中使用 SQL,在通信中使用 .net WEBApi2。我已经阅读了有关 BreezeJS 的信息,并且想将其用作
我一直在尝试使用 Breezejs 和 WebAPI OData Controller 发布一个实体。 配置如下: config.Routes.MapODataRoute( routeName: "o
最近我们将后端 web api 从 .Net 4.61 升级到 .Net Core 2.0,我们正在使用 Breezejs,我们对此很满意,升级后我们遇到了两个无法在线找到答案的问题: 用 did 升
我是一名优秀的程序员,十分优秀!