MVVM pattern for ASP.NET Webforms?

后端 未结 5 1839
执念已碎
执念已碎 2020-12-14 07:15

I\'m looking for an MVVM implementation for ASP.NET. How should I approach this ? Can you propose any design that solves this problem particularly for ASP.NET Webforms ?

5条回答
  •  一生所求
    2020-12-14 07:43

    A lot of MVC'ers are doing something akin to a view model in the sense that instead of returning domain objects to the controller, they have a flattened data structure (a view model) of all the data needed for that view regardless of how many domain objects worth of data it contains. In that regard a view model is very doable with MVC, and I'm sure it could be leveraged in webforms as well. However, there is no way that I know of to do the two way databinding / commanding / event aggregation that is associated with MVVM in WPF.

    Although I don't know of any webform implimentations you could try some of the approaches described here:
    Jimmy Bogard - How we do MVC

    Here is a very interesting article on how to do MVP in winforms:
    Castle Windsor's MVP with ASP.NET

    Maybe you can create a hybrid of these two approaches using webforms.

提交回复
热议问题