02 2012 档案
摘要:常见问题:无法更改关系,因为一个或多个外键属性不可以为 null。对关系作出更改后,会将相关的外键属性设置为 null 值。如果外键不支持 null 值,则必须定义新的关系,必须向外键属性分配另一个非 null 值,或必须删除无关的对象。解决方法:例如OrderItem和Product是一对多的关系OrderItem.ProductId是关系的外键你要先删除对product的引用,比如表OrderItem里有一个到Product.Id的外键的话,需要将其设为空值对应。所以在删除之前要将OrderItem.ProductId设置为0或null
阅读全文
摘要:对关系使用默认规则与配置In Chapter 3, you learned about convention and configuration that affect attributes of properties and the effects that these have on the database. In this chapter, the focus will be on convention and configuration that affects the relationships between classes. This includes how classes
阅读全文