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

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>.

主站蜘蛛池模板: 连云港市| 信阳市| 高邮市| 汪清县| 团风县| 新蔡县| 江门市| 秀山| 昌吉市| 临沧市| 渑池县| 广丰县| 江西省| 顺昌县| 麦盖提县| 博乐市| 海安县| 东明县| 延吉市| 桦甸市| 贵南县| 长葛市| 昌江| 庐江县| 临夏市| 闽清县| 观塘区| 西乌珠穆沁旗| 云霄县| 宜宾市| 顺义区| 赣州市| 偏关县| 高碑店市| 肥城市| 商水县| 宁陵县| 龙门县| 田东县| 山阳县| 巫山县|