剛開始學習EF,在閱讀別人代碼的時候看到導航屬性,網(wǎng)上沒有找到關于導航屬性的詳細說明,只知道是設置多表關聯(lián)的,代碼如下/// <summary>/// /// </summary>[XmlIgnoreAttribute()]
[SoapIgnoreAttribute()]
[DataMemberAttribute()]
[EdmRelationshipNavigationPropertyAttribute("Gift163DBModel", "FK_PRODUCTT_REFERENCE_PRODUCTT", "ProductTypes1")]public EntityCollection<ProductTypes> ProductTypes1
{get{return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<ProductTypes>("Gift163DBModel.FK_PRODUCTT_REFERENCE_PRODUCTT", "ProductTypes1");
}set{if ((value != null))
{
((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<ProductTypes>("Gift163DBModel.FK_PRODUCTT_REFERENCE_PRODUCTT", "ProductTypes1", value);
}
}
}數(shù)據(jù)庫表中沒有ProductTypes1這個字段,請問這段代碼是EF自動生成的還是手寫的呢?調用代碼如下public ActionResult LeftTree()
{var items = _ProductTypesBLL.Get().Where(a=>a.ProductTypes2.Name.Equals("按地域分")).Take(11);return View(items);
}
添加回答
舉報
0/150
提交
取消