摘要:        
使用Data Annotations:如果我们要到一对主从表增加级联删除,则要在主表中的引用属性上增加Required关键字,如: public class Destination { public int DestinationId { get; set; } public string Name { get; set; } public string Country { get; set; } public string Description { get; set; } public byte[] Photo {...    阅读全文
posted @ 2013-01-22 18:53
Gyoung
阅读(7581)
评论(4)
推荐(9)
        
            
        
        
摘要:        
一对多关系项目中最常用到的就是一对多关系了。Code First对一对多关系也有着很好的支持。很多情况下我们都不需要特意的去配置,Code First就能通过一些引用属性、导航属性等检测到模型之间的关系,自动为我们生成外键。观察下面的类:View Code public class Destination { public int DestinationId { get; set; } public string Name { get; set; } public string Country { get; set; } publi...    阅读全文
posted @ 2013-01-22 11:34
Gyoung
阅读(22110)
评论(28)
推荐(64)
        

 
         浙公网安备 33010602011771号
浙公网安备 33010602011771号