ASP.NET MVC ViewModel Console

Should I only consider ASPM MVC ViewModels with flat and primitive types, or should I contain complex Core / Domain model types?

I am looking for best practices.

Thank.

+3
source share
1 answer

Do what makes sense.

There are no authoritative sources that will tell you that using ViewModel with primitive types would kill kittens because they would be wrong. And for every expert who tells you that using ViewData with magic strings is fine, there will be purists who will tell you that strongly typed objects are the only way to go.

, -. ( ViewData ViewModel), , ViewModel -. ViewModel , , , , .

Linq to SQL, , , Linq to SQL. , ViewModel ViewModel ( IEnumerable IQueryable ) .

ViewData, . , , .

+6

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


All Articles