Well, firstly, you have to stick with the atomic unit of work, which you will specify as one method in your BLL. This could (for example) create a customer, order and order elements. you would neatly wrap all of this inside a TransactionScope statement. TransactionScope is the secret weapon here. below is the code, which, fortunately, I am working now :):
public static int InsertArtist(Artist artist) { if (artist == null) throw new ArgumentNullException("artist"); int artistid = 0; using (TransactionScope scope = new TransactionScope()) {
hope you get the gist. basically, this is all a successful or unsuccessful task, regardless of any disparate databases (i.e., in the above example, the artist and the artist-artist can be located in two separate db repositories, but TransactionScope will take care of it less, it works at the COM + level and controls the atomicity of the region that he can "see")
hope this helps
EDIT:, you will find that the initial TransactionScope call (when the application starts) may be slightly noticeable (i.e., in the above example, if it is called for the first time, it can take 2-3 seconds), but subsequent calls are almost instantaneous (t i.e. usually 250-750 ms). the trade-off between a simple contact transaction with (bulky) alternatives softens (for me and my clients) the initial download delay.
just wanted to demonstrate that lightness does not come without compromise (albeit in the initial stages)
lockNetMonster
source share