New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reuse TodoItem class #18
Comments
Probably you can reuse |
As far as I can tell, the NewTodoItem is a good example of a Dto (aka view model, resource model, etc). I really like that design pattern, so I looked seeing it in this book. But I can see how that would have seemed a bit unclear to beginner programmers. |
@Welkie Yeah, that's exactly what I was trying to illustrate (DTOs). This example didn't come out as clean as I wanted because the properties are identical to |
@sadqiang I agree, it would be cool to show model binding - feels like it might be outside the scope for now though. In a more complex application model binding could be very useful. |
@nbarbettini I really like DTOs, I use them for add, edit, delete, command use cases, etc. But they do add a lot of code that beginners (like me, before I took that class in school) can have trouble understanding. It feels like fluff to them, layers in between without purpose. I think that this book would be best without them, just using the model classes for changing data in the database. I think DTOs aren't really an ASP.NET Core thing, they're a web development in general thing, and that they would be a great entry in that "extra" category we discussed adding in previous issues, along with subjects like AJAX, SPAs, etc. Might you be interested in a pull request for a chapter on them now that my school is dying down and I have some time to make meaningful contributions to the book? :) |
In my perspective if
Of course DTO is another good aspect! |
What I decided to do in fbddcae was:
Thanks to both of you for the feedback! |
Is the
NewTodoItem
POCO an unnecessary duplication ofTodoItem
?My initial thought was keeping everything super clean and separate, but that might be a little too much.
The text was updated successfully, but these errors were encountered: