concept null in category entity framework
appears as: null

This is an excerpt from Manning's book Entity Framework Core in Action.
But before I cover these approaches, you need to be aware that EF Core won’t load any relationships in an entity class unless you ask it to. If you load a
Bookclass, each of the relationship properties in theBookentity class (Promotion,Reviews, andAuthorsLink) will benullby default.
Listing 2.11 The
OrderBooksByquery object methodpublic static IQueryable<BookListDto> OrderBooksBy (this IQueryable<BookListDto> books, OrderByOptions orderByOptions) { switch (orderByOptions) { case OrderByOptions.SimpleOrder: #1 return books.OrderByDescending( #1 x => x.BookId); #1 case OrderByOptions.ByVotes: #2 return books.OrderByDescending(x => #2 x.ReviewsAverageVotes); #2 case OrderByOptions.ByPublicationDate: #3 return books.OrderByDescending( #3 x => x.PublishedOn); #3 case OrderByOptions.ByPriceLowestFirst: #4 return books.OrderBy(x => x.ActualPrice); #4 case OrderByOptions.ByPriceHigestFirst: #4 return books.OrderByDescending( #4 x => x.ActualPrice); #4 default: throw new ArgumentOutOfRangeException( nameof(orderByOptions), orderByOptions, null); } } #1 Because of paging, you always need to sort. You default sort on the primary key, which is fast. #2 This orders the book by votes. Books without any votes (null return) go at the bottom. #3 Orders by publication date—latest books at the top #4 Orders by actual price, which takes into account any promotional price—both lowest first and highest first
Figure 6.5 The
[Required]and[MaxLength]attributes affect the mapping to a database column. The[Required]attribute indicates that the column shouldn’t benull, and the[MaxLength]attribute sets the size of thenvarchar.![]()