MVC 3 (Preview 1) Dynamic View

I just reviewed the new features available in the preview of MVC 3: ScottGu Blog . There are many good improvements, and it is worth reading to see where the MVC is.

What struck me was the addition of a dynamic ViewModel type. The fact is that you will not need to reference the data with ViewModel["Message"], but can use ViewModel.Message.

What do people think about this? I am trying to understand why dynamic types should be used this way. This almost gives a false sense of security for developers who are challenged by a member because they implicitly believe that they are strongly typed. At least when you see an indexer with a magic string, you are aware of the possibility of a run-time error.

What do other people think about this? Is this a reasonable use of the dynamic type?

+3
source share
2 answers

, . - , , , , . FWIW, ViewData , "".

. , , .

+3

, , , , .

ViewData [ "string" ], .

. , , - , , .

+2

Source: https://habr.com/ru/post/1756943/


All Articles