Created
January 4, 2018 20:33
-
-
Save gilles-leblanc/4616f3fb9663cbd02c4a1d73de6bcf38 to your computer and use it in GitHub Desktop.
Are ViewBag DTOs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I would personally use the term DTO only when the Data is being transferred across layers, services or applications. | |
Wikipedia defines it as: | |
is an object that carries data between processes | |
Also this highly upvoted answer on StackOverflow says: | |
A Data Transfer Object is an object that is used to encapsulate data, and send it from one subsystem of an application to another. | |
And: | |
DTOs are most commonly used by the Services layer in an N-Tier application to transfer data between itself and the UI layer. | |
Here we are talking about sending data from the Service Layer to the Web Application which are separate IIS applications not necessarily located on the same machine. | |
In the case of the ViewBag, you are still on the same layer/subsystem, the Web Application and not crossing any application boundaries. | |
You could argue that the View and the Controller are different subsystem, but debating such an argument would fall close to opinions rather than facts. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment