Simple way to return anonymous types (to make MVC using LINQ possible)

后端 未结 6 1960
囚心锁ツ
囚心锁ツ 2021-01-05 19:03

I\'d like to implement MVC while using LINQ (specifically, LINQ-to-entities). The way I would do this is have the Controller generate (or call something which generates) th

6条回答
  •  逝去的感伤
    2021-01-05 19:10

    Use a view model layer. Your view has to know what it is going to display. I guess its possible to create a view that just formats a multi-dimensional array of data, but that isn't exactly the best reason to go with an MVC solution. You can however populate a view model with an anonymous object for consumption in your view.

提交回复
热议问题