I have client calls coming in to WCF Service and then through Fluent NHibernate querying the db.
At the moment WCF is left as it's default (i.e., per call).
And in my code I do something like this:
using (_repository.DbContext.BeginTransaction()) {
try {
_repository.SavePerson(object);
_repository1.SaveAddress(object1);
} catch {
_repository.DbContext.RollbackTransaction();
throw;
}
}
since DbContext
is the same for both _repository
and _repository1
. Do I need to do a RollBack on _repository1
?
Also now since the Save methods in the repositories, the Session object is used to save the objects.
What I need to know is, is this Session the same for both calls, or are they 2 different ones? I am assuming they to be the same since I am grouping them in transaction scope as one unit of work.
Also How does this coordinate with WCF calls, do I need to handle transactions from WCF side as well?