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

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

主站蜘蛛池模板: 绿春县| 平湖市| 林州市| 璧山县| 运城市| 盘山县| 苍溪县| 大竹县| 林周县| 静宁县| 新和县| 翁牛特旗| 瑞昌市| 吉林省| 新绛县| 乌恰县| 会东县| 宜君县| 治县。| 大连市| 灵台县| 怀远县| 两当县| 璧山县| 兴和县| 小金县| 郧西县| 若羌县| 新蔡县| 玛纳斯县| 陆丰市| 玉屏| 买车| 平舆县| 加查县| 辽源市| 大冶市| 色达县| 长治县| 沂源县| 普定县|