- 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.
推薦閱讀
- Flask Web全棧開發實戰
- Python自然語言處理實戰:核心技術與算法
- 深入淺出WPF
- 算法精粹:經典計算機科學問題的Java實現
- Scratch 3游戲與人工智能編程完全自學教程
- Python高效開發實戰:Django、Tornado、Flask、Twisted(第3版)
- Gradle for Android
- 大模型RAG實戰:RAG原理、應用與系統構建
- Java系統化項目開發教程
- Java Fundamentals
- 代替VBA!用Python輕松實現Excel編程
- QGIS 2 Cookbook
- 從Excel到Python數據分析:Pandas、xlwings、openpyxl、Matplotlib的交互與應用
- Learning VMware vSphere
- STM8實戰