问题
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