- 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.
推薦閱讀
- Clojure Programming Cookbook
- Visual C++串口通信開發入門與編程實踐
- Mastering SVG
- Mastering Concurrency in Go
- Bootstrap 4:Responsive Web Design
- The HTML and CSS Workshop
- Getting Started with Hazelcast(Second Edition)
- 青少年信息學競賽
- Unity 2017 Mobile Game Development
- INSTANT JQuery Flot Visual Data Analysis
- 3ds Max 2018從入門到精通
- Mastering Drupal 8
- JavaScript重難點實例精講
- Hands-On Game Development Patterns with Unity 2019
- Python程序設計教程