Cart
{
CompositeId().KeyProperty(x => x.CART_ID, "CART_ID").KeyProperty(x => x.COMM_CD, "COMM_CD");
References(x => x.Product, "COMM_CD");
}
当我尝试将购物车对象保存到数据库时,我收到超出范围的异常。我认为这是因为我有两个COMM_CD属性。有没有办法解决这个问题?
由于
答案 0 :(得分:2)
您需要使用KeyReference
代替KeyProperty
CompositeId()
.KeyProperty(x => x.CART_ID, "CART_ID")
.KeyReference(x => x.Product, "COMM_CD");