This feels like I've misconfigured something simple, resulting in code
not enlisting in an ongoing DTC transaction.
I'm seing different ServicedComponent behavior when I have 1 [AutoComplete]
method call 4 other ServicedComponents vs having 4 different [AutoComplete]
methods call just 1 method each of a the same 4 other ServicedComponents.
[Its tough to explain briefly, please read on.]
In the 1st case, everything succeeds, but only the data from the 1st insert
is present after the txn completes. In the 2nd case, all the data is
present after the 4th txn completes.
BusinessA is a ServicedComponent that exposes an [AutoComplete] method
'InsertThem'. BusinessA is [Transaction.Required / ReadCommitted], and is
a client of 4 classes in ServicedComponent DataB.
All the classes in DataB are [Transaction.Supported / ReadCommitted]. All
the public methods of DataB are clients of MS SQL Server 2K Sprocs. These
methods all call ContextUtil.MyTransactionVote = TransactionVote.Commit
when they succeed.
BusinessA and DataB have their ApplicationActivation set to
ActivationOption.Library.
I've a WebService client WC that calls BusinessA.InsertThem, and then
Disposes BusinessA.
InsertThem grabs a SqlConnection from the pool (the connection string does
*not* say Enlist=true or Enlist=false), and calls into DataB:
[AutoComplete]
InsertThem( ...omitted for clarity... )
{
using( SqlConnection cn = new SqlConnection( ... ) )
{
using( DataB.First first = new DataB.First() )
{
first.InsertIt( cn, ... );
}
using( DataB.Second second = new DataB.Second() )
{
second.InsertIt( cn, ... );
}
using( DataB.Third third = new DataB.Third() )
{
third.InsertIt( cn, ... );
}
using( DataB.Fourth fourth = new DataB.Fourth() )
{
fourth.InsertIt( cn, ... );
}
}
}
After this code, only the data from first.InsertIt is in the RDBMS. The
DTC log says the txn succeeded.
If I change WC to expose 4 methods, to call InsertThem1, InsertThem2,
InsertThem3 and InsertThem4 respectively, all the data is in the RDBMS
after InsertThem4:
[AutoComplete]
InsertThem1( ... )
{
using( SqlConnection cn = new SqlConnection( ... ) )
{
using( DataB.First first = new DataB.First() )
{
first.InsertIt( cn, ... );
}
}
}
[AutoComplete]
InsertThem2( ... )
{
using( SqlConnection cn = new SqlConnection( ... ) )
{
using( DataB.Seccond second = new DataB.Second() )
{
second.InsertIt( cn, ... );
}
}
}
Any clues or tips greatly appreciated.
Thanks,
Howard Hoffman
===================================
This list is hosted by DevelopMentor� http://www.develop.com
NEW! ASP.NET courses you may be interested in:
2 Days of ASP.NET, 29 Sept 2003, in Redmond
http://www.develop.com/courses/2daspdotnet
Guerrilla ASP.NET, 13 Oct 2003, in Boston
http://www.develop.com/courses/gaspdotnet
View archives and manage your subscription(s) at http://discuss.develop.com