Skip to content

Instantly share code, notes, and snippets.

@christiannagel
Last active January 4, 2019 09:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save christiannagel/ee93d99e18bc444a3b48e5c381088c93 to your computer and use it in GitHub Desktop.
Save christiannagel/ee93d99e18bc444a3b48e5c381088c93 to your computer and use it in GitHub Desktop.
Book class to use lazy loading with EF Core
public class Book
{
public Book(int bookId, string title) => (BookId, Title) = (bookId, title);
public int BookId { get; set; }
public string Title { get; set; }
public virtual ICollection<Chapter> Chapters { get; } = new List<Chapter>();
public int? AuthorId { get; set; }
public int? ReviewerId { get; set; }
public int? EditorId { get; set; }
public virtual User? Author { get; set; }
public virtual User? Reviewer { get; set; }
public virtual User? Editor { get; set; }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment