我正在寻找一种在BeforeSaveEntity方法中组织验证规则的好方法,我在文件中找到了这个注释:项目中的TodoContextProvider.cs:BreezeMvcSPATemplate:
// A second DbContext for db access during custom save validation.
// "this.Context" is reserved for Breeze save only!
Run Code Online (Sandbox Code Playgroud)
为什么this.Context无法使用?
我理解聚合根的概念,我知道一个聚合根必须通过身份引用另一个(http://dddcommunity.org/wp-content/uploads/files/pdf_articles/Vernon_2011_2.pdf)所以我没有得到的是如何强制Entity Framework在两个聚合之间添加外键约束?
让我们假设我有一个简化的域:
public class AggregateOne{
[Key]
public Guid AggregateOneID{ get; private set;}
public Guid AggregateTwoFK{get; private set;}
/*Other Properties and methods*/
}
public class AggregateTwo{
[Key]
public Guid AggregateTwoID{get; private set;}
/*Other Properties and methods*/
}
Run Code Online (Sandbox Code Playgroud)
使用此域设计,Entity Framework不知道AggregateOne和AggregateTwo之间存在关系,因此生成的数据库中没有外键.
我正在尝试使用"Amplifyjs"来处理AJAX请求,就像John Papa在他的Pluralsight课程中一样,但我遇到了身份验证方面的问题.
我正在使用表单身份验证.一切正常.
我的问题来自未经身份验证的请求.我找不到一种方法让"amplifyjs"回复错误函数http代码(401,403 ...)来区分失败的请求,因为它们未被验证因为没有遇到业务逻辑而失败的请求.
请求示例如下:
amplify.request.define("products", "ajax", {
url: "/api/Products",
datatype: "json",
type: "GET"
});
amplify.request({
resourceId: "products",
success: callbacks.success,
error: function (datos, status) {
//somecode
}
});
Run Code Online (Sandbox Code Playgroud)
谢谢.