开发者

Ideas to address MVVM project and ever increasing size of MainViewModel / Model?

开发者 https://www.devze.com 2023-02-23 00:12 出处:网络
I am 开发者_如何学Gostarting on expanding a simple MVVM C# application. The Model and the basic ModelView are starting to grow to unmanageable sized - I have split out the data access of the Model to

I am 开发者_如何学Gostarting on expanding a simple MVVM C# application. The Model and the basic ModelView are starting to grow to unmanageable sized - I have split out the data access of the Model to reduce complexity, and even this is getting uncomfortably big.

Does anyone have any suggestions on what to refactor before it all collapses under it own weight? I am open to everything from componentizing to throwing it all away.

Thanks in advance


A View to ViewModel doesn't have to be 1 to 1. Break the Views and ViewModels in to smaller manageable pieces. Your main View and ViewModel can be an aggregation of smaller Views and ViewModels. Say you had a view, CustomerView, that had a ListBox and a couple grids. CustomerView is associated with CustomerViewModel. The ListBox and grids could be put in their own Views and ViewModels. So you might have and it's associated CustomerListViewModel and the same could apply to the grids.

0

精彩评论

暂无评论...
验证码 换一张
取 消