Pregunta

Quick question (and my last today about SCSF) about what Services are intended to be used for.

Services exist within the WorkItem, so I assume they are supposed to provide UI services specifically. Only the code I'm hating on at the moment is using them for business services which is making the whole MVP separation, specifically the M from VP not so separate.

¿Fue útil?

Solución

I know you probably won't even care about the answer at this point, but its my first shot at answering something at SO, so here it goes.

I've been using SCSF for about 6 months so far, so I am not an expert by any means but a couple of the things I've been mainly using Module Services for:

  • When making a "business service" call (which I assume from your question means making a call to a data store of some sort or calling a web service etc.) you can use a service to attach any additional data that might not be directly related to the business logic but necessary to be persisted with the call to the database. One example I can provide is attaching the currently logged in user credentials to a call to web service or to the database for audit trail logging. You call the Service from your presenter which appends any additional info and proceeds the call to the next layer.

  • Another use for Services is to abstract any implementation of UIExtensions away from your modules. If you are using a Ribbon for example, you can have a Service which gets injected into your
    business modules with methods such as "AddRibbonButton()" or
    "AddRibbonGroup()" which your modules can call to add the necessary
    user interface elements when loading up without worrying about how
    its done.

Hope that helps!

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top