>>
A tabpage should handle a usecase (kind of a CAB workItem light if I understood that part of CAB)
<<
Yes, that sounds about right.
>>
* A tabPage controls the UserControls that it hosts
<<
Something has to, if the UserControls are to be independent, flexible, and reusable. So yes, in this case, I chose the TabPage to do that.
>>
* A Usercontrol handles the UI for a "single entity", merely setting up databinding and showing what the tabPage pushs into it and firing events (CurrentChanged,UserWantCHeckIn, ...).
<<
More or less, but as I said, the "single entity" doesn't have to be literally a single type: just something you want to treat conceptually as one thing (like an Order with its line items).
>>
* the FrmMain manage situations where a use case interfere with an other one.
<<
I'm pretty sure the answer is "yes", but give me a "for instance" if you like.
>>
* the "use case controller" part of the code in the tabPage could be taken out if I want to have different UIs supporting the same Use case like flipping between mdi and tabs or having a web interface (to a certain extend).
<<
Sure, you could use some other container.
>>
1> I see that the UserControl uses a persistenceManager, wouldn't that break with the TabPage having the reponsability? like when the CustomerUserControl go get customers using it?
<<
Note (in EmployeeUserControl, let's say) that there are two overloads of the LoadMainData() method. One allows the calling code to push into the UserControl the collection of Employees to be used; the other loads all Employees. The one that loads all Employees is there as a convenience, to support a "default" scenario. It permits the TabPage to delegate to the UserControl the responsibility for deciding what Employees to load. But that's the TabPage's decision.
The other use of the PersistenceManager in EmployeeUserControl is to load "supporting data" - basically the collections needed to populate ComboBoxes on the form. For simplicity, my use case said those ComboBox item collections would be the same for all scenarios. If they're not, you could add a second overload of LoadSupportingData() that permitted the collections to be passed in.
>>
2> The use of an interface (IEntityUserControl here) should open for loosing the coupling between a tabPage and a concrete UserControl but I can't see you are using it. Is their any reasons for that? (I am thinking of using Interface to have different lay out of the "same" control for different clients)
<<
I'm just using the interface to guarantee that each UserControl will have a standard set of facilities, so that the containers that work with them (TabPages in this case) can do so in a consistent and predictable manner. I don't see why you couldn't also use it as you suggest, however.
Greg Dunn