开发者

How to Shift from MVP pattern to SCSF CAB pattern?

开发者 https://www.devze.com 2023-03-03 02:33 出处:网络
I have designed and developed my application in MVP Pattern. I have not used any software factory to achieve this. Now i want to shift to SCSF pattern and CAB structure.

I have designed and developed my application in MVP Pattern. I have not used any software factory to achieve this. Now i want to shift to SCSF pattern and CAB structure.

I need to know if it can be done in any easier way as CAB structur开发者_开发问答e implements MVP only.


I would agree with Wali. you have got your views ready . Assuming they are in perfect MVP. now you need to classify them into Modules. We created child workitems, so that when a use case is started it was a new instance of child workitem added to the workitems collection of the module. So when the use case is completed we simply terminated the child workitem. If any exception occurs then the childworkitem is the one going to be affected now the Module's work item. SCSF has feature where you can compose multiple views on the screen. So you need to look out if you can use ZoneWorkspace to avoid duplicate UI and logic. Decide how the modules are going to communicate, say events or Commands. How data is going to be passed between views and modules. Now you have the Shell, you need to decide what all regions you are going to have on the shell. What comes by default on the shell. How the modules listen to Shell. What events Shell listen from modules to customize itself.

SCSF has dependency injection. So decide what are the UI Services you are going to have. Inject them in to Presenter accordingly.


In CAB and SCSF, there is code-ready MVP classes (and interfaces). So if you have implemented it cleanly, then you can just copy your methods once you get a hang of the classes.

Will try to brief it :-

1) IView -- Its a reference of View, which exposes only those set properties/Methods which can be accessed by Presenter (or any other class)

2) View -- It has a reference of Presenter and can access all the public/protected methods of presenter. By design it cannot access any service, as you would require WorkItem (container of Services, State, Command, Events Etc). For all practical purpose View is only there to manage the UI controls, Binding, State of object Etc.

3) Presenter -- It has a reference to WorkItem (through which you can access all the services). Presenter's responsibility it to manipulate data with the help of Services.

4) WorkItemController -- WorkItemController can take UseCase related functionality as in wiring/unwiring of ui controls, positioning of view etc.

Its more than just MVP in SCSF/CAB as its overall design of a UI Application. Which has the following :-

  1. Modular Structure
  2. On-Demand architecture.
  3. Service Pattern
  4. Commands
  5. Event Handlers Etc.

So firstly you have to check codeplex docs to see if your project would be easily upgraded in that platform/architecture. I would recommend CAB/SCSF if you have just begun and thinking of making the project scalable and enterprise level.

0

精彩评论

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

关注公众号