- Mastering Entity Framework Core 2.0
- Prabhakaran Anbazhagan
- 133字
- 2021-07-02 21:16:40
Working with the Blog entity
We have discussed in detail the Blog model in Chapter 1, Kickstart - Introduction to Entity Framework Core, but still, the following highlighted part looks pretty new to us:
- The Blog() constructor initializes the Post property, which ensures that the collection has a concrete HashSet list created and ready to accept any new items
- The Post property has a virtual keyword, which instructs EF to lazy load the navigational property Post:
public partial class Blog
{
public Blog()
{
Post = new HashSet<Post>();
}
public int Id { get; set; }
public string Url { get; set; }
public virtual ICollection<Post> Post { get; set; }
}
There is nothing much to explore in the Blog class so, let's move on to the Post class.
推薦閱讀
- Learning LibGDX Game Development(Second Edition)
- C++程序設計(第3版)
- Django Design Patterns and Best Practices
- Visual C
- Arduino家居安全系統構建實戰
- Terraform:多云、混合云環境下實現基礎設施即代碼(第2版)
- Android項目實戰:手機安全衛士開發案例解析
- Building Wireless Sensor Networks Using Arduino
- 后臺開發:核心技術與應用實踐
- Learning Grunt
- Instant GLEW
- Python編程基礎教程
- Selenium WebDriver Practical Guide
- VMware vSphere 5.5 Cookbook
- HTML5 WebSocket權威指南