- Mastering Entity Framework Core 2.0
- Prabhakaran Anbazhagan
- 116字
- 2021-07-02 21:16:37
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>.
推薦閱讀
- Mastering ServiceStack
- 無(wú)代碼編程:用云表搭建企業(yè)數(shù)字化管理平臺(tái)
- AWS Serverless架構(gòu):使用AWS從傳統(tǒng)部署方式向Serverless架構(gòu)遷移
- 三維圖形化C++趣味編程
- 零基礎(chǔ)學(xué)MQL:基于EA的自動(dòng)化交易編程
- HTML5 and CSS3 Transition,Transformation,and Animation
- VMware虛擬化技術(shù)
- 大學(xué)計(jì)算機(jī)基礎(chǔ)實(shí)驗(yàn)指導(dǎo)
- Test-Driven Machine Learning
- 零基礎(chǔ)學(xué)Kotlin之Android項(xiàng)目開(kāi)發(fā)實(shí)戰(zhàn)
- QGIS Python Programming Cookbook(Second Edition)
- 零基礎(chǔ)學(xué)C語(yǔ)言程序設(shè)計(jì)
- Java 9 Programming By Example
- 零基礎(chǔ)輕松學(xué)C++:青少年趣味編程(全彩版)
- Mastering Android Studio 3