Popularity of MVP for SharePoint WebParts

半世苍凉 提交于 2019-12-10 17:04:42

问题


Is it a popular techinque to use the Model View Presenter (MVP) design pattern when creating Web Parts for SharePoint? It seems (to me) that this pattern is applied more often in the custom application space. So, if you have any thoughts on this, please share...

[Edit]
Perhaps the more important question is, if MVP is less popular in a SharePoint WebPart than in a custom application, why do you think this is (what factors contribute to this observation)?


回答1:


It's probably not popular, but it's also probably a good design practice.

Perhaps the more important question is, if MVP is less popular in a SharePoint WebPart than in a custom application, why do you think this is (what factors contribute to this observation)?

It is the "new" approach in the SharePoint world. Everyone is used to doing it the old SharePoint way. This is also true of ASP.NET and ASP.NET MVC.

MVC and MVP patterns are becoming more popular because they allow you to "decouple" the presentation layer from the underlying logic, essentially "uncomplicating" the UI.

Personally, I think anything that makes SharePoint an easier platform to program on is a welcome relief.




回答2:


Because SharePoint is not compatible with ASP.NET MVC? It's planned somewhere down the line.. e.g. you're doing a lot of plumbing yourself before you can get any functionality going and I imagine out of all web parts created for SharePoint most will not be very complex because they are likely to be only a small part of the complete -SharePoint- solution.

Here is someone who built something like it, sort of: ARF




回答3:


I have developed some webparts for SharePoint using MVP Pattern and I find it pretty good from the point of testability. However I discovered following problem: If you have a webpart with custom EditorPart (the pane with custom properties) then the decoupling through MVP is not easily achievable, because the data from Toolpart is stored back to the WebPart.

Second thing: I do not think that the MVC pattern will be introduced into SharePoint soon (my oppinion I am not an insider), the impact would too big. However there exists an SharePointMVC

Framework. This has a rather big disadvantage that you have to create a seperate WebApplication for it.



来源:https://stackoverflow.com/questions/1665163/popularity-of-mvp-for-sharepoint-webparts

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