I would like some advice about the architecture (of a WinForms app) trying to implement DDD and EF, since I am still learning and I am confused in some aspects. I also try to implement MVP but I'm not sure if its the best (or needed) for WinForms, since I think I'm mixing some concepts.
This is what I have now, trying to "design" a generic app.
But after a lot of reading and lot of opposite positions I still have some question here:
-
I read I shouldn't use my domain model for the UI, so I need some pattern like MVP or MVVM or whatever. In "small" apps should I still separate this or it doesnt bring so much improvements?
-
I read I shouldn't use repository if using EF, since the DBSet is a Repository. For me the repo is an art of wrapping "queries". I lose some EF capabilities but I can implement them in the Repository if needed. For the rest of my app this EF properties are not important. They are sth were users of the repository can look like "what can I retrieve from the DB", but maybe I understand it wrong.
-
Should I have Entity classes (POCOs) (classes mapping 1-1 the database tables and its properties) or should I use my domain model for persistance and map to the Database with the Fluent Api?
-
Last Question is Services:
Services should orchestrate the interaction with business logic and its classes, like for example OrderRegistrationService
, that knows what the BL needs to do to Register and Order (that can involve different BL classes and maybe Common classes/methods). So it just offer an BL-API for the layers above, or I am wrong?
But then how are they different of the presenter? The presenter will now how services to call, get data (as domain classes), converto to ViewModel and pass to Form? So Presenter is the same for the UI as the services for the BLL? It just know what's need to be done when a button is pressed or event raised, and call the different services, that can call the BLL, that can do sth or get data and pass it back.
Should I always use services, if I'm trying to keep clean code and architecture, indenpendently of the app size? I read the service layer should be in a separate assembly, what I dont understand, since the assembly, to be reused, needs the BLL?
Aucun commentaire:
Enregistrer un commentaire