Is it considered poor design to create "black box" User Controls that communicate directly with the service layer (to perform CRUD operations, validation, etc)?
By "black box", I mean that they retrieve/persist data independently of the page they are hosted on (using IoC injected services). Each UC can be dropped onto a page and it will just work. Mind you, there is no business logic embedded in any of these UCs whatsoever (that's all in the Domain layer).
This approach was driven by two factors:
- Our application has many pages that are essentially variants on the same view (with slightly different layouts).
Furthermore, our UI designer is fond of allowing discrete parts of a page to be opened up for editing. Click here for a poor attempt at illustrating this concept.
Anyway, it felt like giving the UCs the ability/responsibility to render and persist themselves would do away with quite a bit of code duplication.
If this approach is indeed considered "icky", please feel free to suggest an alternate one that is more appealing (perhaps MVP?) I'm stuck with WebForms for the foreseeable future.
Thanks!