[英]New table with a foreign key to identityuser
I want my newly created table userId to be a foreign key to IdentityUser. 我希望新创建的表userId是IdentityUser的外键。 The scenario is that, I want each user to have a favorite movie, so how do I go about this? 场景是,我希望每个用户都有一部喜欢的电影,那么我该如何处理呢?
public class FavoriteMovie
{
public int Id { get; set; }
public string Name { get;set; }
public string Amount { get;set; }
public string WhereIsBeenSold { get;set; }
}
I want if a user add a friend and click on his profile, he should be able to view that particular friend's favorite movie info. 我希望用户添加朋友并单击其个人资料时,他应该能够查看该朋友最喜欢的电影信息。
How do I set the relation between then and also how do I make the friend name click-able so that he can be navigated to his favorite movie? 我该如何设置两者之间的关系,又如何使朋友名称可点击,以便可以将他导航到他最喜欢的电影?
You can design your database as like this: 您可以这样设计数据库:
1.Create User table which has unique/primary key identification for each user. 1.创建用户表,该表具有每个用户的唯一/主键标识。
3.Make your user id as a foreign key to the Movie table. 3.将您的用户ID用作Movie表的外键。
If you want more help inform me 如果您需要更多帮助,请通知我
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.