Question: Why a BookDTO class is constructed in addition to model entity Book? BookDTO is an alternative of Book object. They two can be used interchangably.
Why a BookDTO class is constructed in addition to model entity Book?
BookDTO is an alternative of Book object. They two can be used interchangably.
BookDTO is used primarily to render contents in the razor view, while Book as a model entity is primarily used in Data Layer.
Book contains navigation property, which cannot be handled well in Json serialization. Therefore BookDTO is constructed for storing data in session.
Bookstore app need an object comprising basic information of book and its authors. Genre is not required. Therefore, BookDTO is constructed without referencing Genre.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
