The one-to-many relationship

So far, the illustrations carried out between the Blog and Post entities have had a one-to-many relationship. If we watch closely, we might be able to figure it out; the Blog entity is the principal entity and the Post entity is the dependent entity where the Blog entity can contain one or more posts (violà! one-to-many was already in place):

    public class Blog    {      public int Id { get; set; }      public string Title { get; set; }      public string Subtitle { get; set; }      public string Url { get; set; }      public string Description { get; set; }      public DateTime CreatedAt { get; set; }      public DateTime ModifiedAt { get; set; }      public int CreatedBy { get; set; }      public int ModifiedBy { get; set; }      public ICollection<Post> Posts ...

Get Mastering Entity Framework Core 2.0 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.