I allow users to save collections of data that are in the process of being edited. I have to support this because they deal with thousands of records which may take hours to edit and if they are interupted then they need to be able to save the work in progress and move onto other tasks. The records are saved in an editing table until the entire batch is valid and ready to be imported into live tables.
When the user opens the records I use a connection manager. The parent grabs a data reader and flips through each one creating child objects along the way. The problem occurs in the child object where a call to ValidationRules.CheckRules calls rules that open additional data readers on the same connection and the whole thing blows up.
Of course, normally one wouldn't check business rules when pulling the objects from a database, but alas, I cannot avoid doing it.
1: Create a separate connection for the parent loading the objects?
2: Load the objects first and then flip though each child and check the rules?Recommendations?
There are actually three options
I'm told that MARS has a perf hit, but I honestly don't know how big a hit it is relative to opening a separate connection. Certainly using MARS is easier (as I understand it) because I think you just change your connection string to turn on the feature.
But for my part I would probably go with multiple connections. The ConnectionManager.GetManager() method accepts a label parameter - each label corresponds to a different connection - so the multiple connection concept is already supported.
Thank you for the thorough response.
I like to run this stuff past the hound dogs at CSLA.NET because they often catch me missing something.
Copyright (c) Marimer LLC