- 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.
推薦閱讀
- Android和PHP開發最佳實踐(第2版)
- Python for Secret Agents:Volume II
- 羅克韋爾ControlLogix系統應用技術
- Unity Shader入門精要
- 零基礎學Python數據分析(升級版)
- 小程序開發原理與實戰
- 青少年Python編程入門
- Learning OpenCV 3 Computer Vision with Python(Second Edition)
- D3.js By Example
- Procedural Content Generation for C++ Game Development
- Python爬蟲、數據分析與可視化:工具詳解與案例實戰
- PHP 7從零基礎到項目實戰
- SQL Server 2008 R2數據庫技術及應用(第3版)
- Java EE Web應用開發基礎
- Android高級開發實戰:UI、NDK與安全