C# MVP What is the model?

好久不见. 提交于 2019-12-12 18:42:44

问题


I started using MVP for the first time on my last project and I'm absolutely confused with it now.

What I was taught regarding MVP is that: The Model in MVP really exists just to provide exactly what the view needs and only what it needs.

So the models that my view would be getting, are unlikely to be representing classes/objects with actual logic on them.

They are in fact, a lot more likely to be just data transfer objects with everything set-up perfectly so that the view has to do nothing but display the data however it sees fit.

BUT from what I gathered online, the model layer is where most of my business logic should reside in.

Why is what I'm finding online about models so different from what I've been taught?

I'm pretty sure I'm confusing concepts here and I really need help in untangling this mess.


回答1:


I think you're on the right track, the Presenter layer should handle most business logic and the Model layer should represent your data or domain model. This is what the text I am working through suggests anyway, and it seems to provide a nice foundation for SOLID in Web Forms.



来源:https://stackoverflow.com/questions/22432309/c-sharp-mvp-what-is-the-model

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!