官术网_书友最值得收藏!

Blog entity

Create a Blog.cs class file and include the following properties:

    public class Blog
{
public int Id { get; set; }
public string Url { get; set; }
public ICollection<Post> Posts { get; set; }
}

The Entity Framework will look for any property with the name Id or TypeNameId and marks them as the primary key of the table. The Posts property is a navigation property which contains Post items related to this Blog entity. It doesn't matter whether we use ICollection<T> or IEnumerable<T> for the navigation property, EF will create a collection for us, HashSet<T> by default. We could also create a concrete collection using List<T>.

主站蜘蛛池模板: 马公市| 左云县| 胶州市| 武山县| 阿拉善盟| 三门县| 万山特区| 大理市| 锦屏县| 蒙阴县| 南丹县| 安宁市| 长丰县| 蒲江县| 望都县| 莱芜市| 高阳县| 三亚市| 河西区| 政和县| 姚安县| 邯郸县| 桂东县| 固镇县| 南通市| 武陟县| 海口市| 潼关县| 潞西市| 宜川县| 墨江| 绥棱县| 马鞍山市| 冷水江市| 鹤庆县| 阿勒泰市| 灌南县| 扎赉特旗| 涟水县| 连山| 会泽县|