ASP.NET EF实体主外键关系

其他解释 https://www.cnblogs.com/wuhenke/archive/2010/08/11/1797307.html

主键、外键

需要删除完外键表才能删除主键表

一对一关系
people表
public
identity identity{get;set;}//当前为主键表
 
identity表
//不需要设置
一对多关系
order表
public ICollection<orderDetail> orderDetail{get;set;}//包含关系,当前为主键表

orderDetail表
public virtual order{get;set;}//外键表

 

posted @ 2019-05-13 22:07  Uyd  阅读(1308)  评论(0编辑  收藏  举报