RE: Visual Studio 2008 TableAdapters and Transactions
- From: stcheng@xxxxxxxxxxxxxxxxxxxx (Steven Cheng [MSFT])
- Date: Wed, 26 Mar 2008 02:58:20 GMT
Hi Andrew,
As for the "Transaction" property of the VS generated TableAdapter, it
actually wrapper the Transaction property on each Command object used in
that TableAdapter. Here is an example of the generated "Transaction"
property (in a certain TableAdapter):
===================
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
internal global::System.Data.SqlClient.SqlTransaction Transaction {
get {
return this._transaction;
}
set {
this._transaction = value;
for (int i = 0; (i < this.CommandCollection.Length); i = (i
+ 1)) {
this.CommandCollection[i].Transaction =
this._transaction;
}
if (((this.Adapter != null)
&& (this.Adapter.DeleteCommand != null))) {
this.Adapter.DeleteCommand.Transaction =
this._transaction;
}
if (((this.Adapter != null)
&& (this.Adapter.InsertCommand != null))) {
this.Adapter.InsertCommand.Transaction =
this._transaction;
}
if (((this.Adapter != null)
&& (this.Adapter.UpdateCommand != null))) {
this.Adapter.UpdateCommand.Transaction =
this._transaction;
}
}
}
===============
As you can see, when you set its value, it will update all the Command
objects(used in this TableAdapter) and synchronize those commands'
"Transaction' property to the same one. This is used when you use the old
means to perform Transaction in ADO.NET:
#SqlConnection..::.BeginTransaction Method
http://msdn2.microsoft.com/en-us/library/86773566.aspx
By setting the Transaction on the TableAdapeter, you make sure all the
commands involved in the TableAdapter get set to the same transaction.
In ADO.NET 2.0, it provides a more convenient Transaction model:
#Transaction Processing in ADO.NET 2.0
http://www.15seconds.com/issue/040914.htm
#Working with Transactions in ADO.NET
http://www.15seconds.com/issue/040914.htm
Hope this help some.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@xxxxxxxxxxxxxx
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
From: "Andrew Jocelyn" <j055@xxxxxxxxxxxxxxxxx>
Subject: Visual Studio 2008 TableAdapters and Transactions
Date: Tue, 25 Mar 2008 17:15:05 -0000
Hi
I've just discovered that the typed DataSet tool now adds a Transaction
property to each TableAdapter. The modifier is internal. It seems to be
undocumented. Are there any examples/best practices on how to use it?
Thanks
Andrew
.
- Follow-Ups:
- Re: Visual Studio 2008 TableAdapters and Transactions
- From: Andrew Jocelyn
- Re: Visual Studio 2008 TableAdapters and Transactions
- References:
- Visual Studio 2008 TableAdapters and Transactions
- From: Andrew Jocelyn
- Visual Studio 2008 TableAdapters and Transactions
- Prev by Date: RE: Adding path info to an GridView asp:Image bound column
- Next by Date: Disable head runat=server for some pages?
- Previous by thread: Visual Studio 2008 TableAdapters and Transactions
- Next by thread: Re: Visual Studio 2008 TableAdapters and Transactions
- Index(es):
Relevant Pages
|
|