When you say 'Role API commands', what exactly does that mean??? You mean the methods in the Role API provider, or the Stored Procedures in the Sql Database implementation??? I believe you mean SPs as calling methods is hardly useful, because they dont support transactions, but open thier own connections for executing operations!!! And supposing you mean SPs, then from a best practices perspective, what is advisable? 1) I create methods in the DAL that call the SP to create the role. Then, have my BL class call the methods for creating department & then the Role one after the another. In that case, the BL would need to be aware of the underlying transaction in some way, and would need to request the DAL to commit, if everything is fine. 2) Have my DAL method to create the department perform 2 operations: i) Create department, and then ii) Create Role. In this case, the BL would be totally abstracted from the underlying trasanction, as the DAL can itself decide when to commit or abort. To me, although the second approach seems more attractive from an implementation point, but logically, the method for creating department should only do that. It is the BL that knows, that creation of department should be followed by creation of a role!!! |