我是ASP.NET新手并尝试新的MVC 6框架。我想创建待办事项列表应用程序。用户身份验证后,我将重定向到仪表板页面,我要显示该页面以执行任务。我已经创建了一个模型任务,但我不确定如何为用户ID添加外键,以便当我将用户重定向到仪表板页面时,我可以根据用户的ID进行查询。
public class Task
{
public int Id { get; set; }
// i want to add a fk to aspnetuser id here
}
感谢您的帮助。
答案 0 :(得分:3)
_.find(theArray, function(questObject){
_.find(questObject.questChains, function(questChain){
if (questChain.questChainId === 1) {
return true;
}
});
});
答案 1 :(得分:0)
假设您的XYZ类具有Id作为主键。
现在你想把XYZ的Id作为ABC类中的外键,
因此,可以像在ABC类中编写以下内容一样。
public Guid XYZId{get;set;}
public XYZ xyz{get;set;}`
xyz是XYZ类的对象。 .net core会自动将XYZId作为ABC类中的fk ..... PLZ注意Id应该是XYZ类中的主要