If you see at the top of an ASP.NET MVC view:
<% var dto = (MyDto)Model; %>
...is something wrong? It doesn't feel right to me...
If you see at the top of an ASP.NET MVC view:
<% var dto = (MyDto)Model; %>
...is something wrong? It doesn't feel right to me...
You should not need to cast the type in this way for a strongly typed view. If the view inherits from ViewPage<MyDto> then the Model property will be of type MyDto.
If the view is not strongly typed then the Model property is of type object so you would need to cast it.
It makes sense to use a strongly typed view in this case though
The question is: Is it good to store DTO objects as the model for View? My answer is: it's depends. DTO should have only one behavior: storing data. So when you using DTO object only for displaying it on View: then it's OK.
View Model is designed to store more compliated objects that contains multiple behaviors, but there is no fault to store DTO's.