Hi Michael,
One potential problem I can see is the line:
if (_scope == null) |
_scope = Database.Get("connFfops").GetObjectScope(); |
|
because this should really never happen if I understand you correctly. Right?
You already call scope.BeginTransaction in the BL method thus the scope is (or at least it should be) initialized.
Basically the code should look something like this (pseudo code):
BL:
obtain a scope
try
{
scope.BeginTransaction();
// Call DAL methods
myDal.PerformSomething();
scope.CommitTransaction();
}
except
{
scope.RollbackTransaction();
}
The point is to keep the scope alive during the business layer transaction. For that purpose you can create an external (to the BL and DAL) that will provide you the scope upon request. The thing here is that this mechanism must provide you the
same scope as long as you're in the same business transaction.
We created a ContextManager for that purpose, but there's also a ScopeFactory class in one of the Telerik examples. Still, the same principle applies: During the business transaction the same scope must be used all the way down the lowers layers (in your case the DAL).. also during multiple calls from BLL to DAL.
Regards
Henrik