Skip to content

Instantly share code, notes, and snippets.

@changhuixu
Created July 11, 2018 18:47
Show Gist options
  • Save changhuixu/59f2b729fe124015b191a7eeb0e353f4 to your computer and use it in GitHub Desktop.
Save changhuixu/59f2b729fe124015b191a7eeb0e353f4 to your computer and use it in GitHub Desktop.
// Author.cs
public class Author
{
public int Id { get; protected set; }
public string FirstName { get; protected set; }
public string LastName { get; protected set; }
private readonly List<Blog> _blogs = new List<Blog>();
public IReadOnlyCollection<Blog> Blogs => _blogs;
}
// Blog.cs
public class Blog
{
public int Id { get; protected set; }
public string Title { get; protected set; }
public string Content { get; protected set; }
public int AuthorId { get; protected set; }
public Author Author { get; protected set; }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment