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

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

主站蜘蛛池模板: 来凤县| 博野县| 开化县| 依安县| 明溪县| 砚山县| 清丰县| 藁城市| 准格尔旗| 蛟河市| 乌鲁木齐市| 绥棱县| 开远市| 奉化市| 凌海市| 安康市| 临邑县| 澎湖县| 项城市| 古田县| 屏山县| 汪清县| 青神县| 额尔古纳市| 遂宁市| 阿克苏市| 上饶县| 曲松县| 怀安县| 门头沟区| 龙岩市| 翁源县| 黄浦区| 泗阳县| 白沙| 女性| 镇沅| 特克斯县| 洛扎县| 龙山县| 汨罗市|