473,395 Members | 1,941 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Transactions through Remoting

Hi,

My data access layer for my VB.NET 1.1 application resides on a different
server and is accessed via Remoting.

Is there a way to configure my data access layer so that I can use
Transactions? For example, I would like to do the following from the client:

Try
DataAccessLayerClass.RunSQL("UPDATE MyTable SET Column3 = "aa", ConnObj,
TransactionObj)
SendEmail()
TransactionObj.Commit
Catch
' Update or sending of email failed
TransactionObj.Rollback
End Try

Any help on how to use Transactions while the data access layer is accessed
via Remoting would be appreciated.
I am also open to rewriting my current code (i.e. change data access
location) if there is an alternative solution.

Thanks.
Aug 2 '06 #1
3 1756
Ryan,

This is a really bad design for your data layer for a number of reasons.

First, you are passing sql statements to your data layer. This is
unadvisable, as you should use stored procs instead. Also, if you have to
pass SQL statements, you should at least make sure that you parameterize
them so that you protect yourself against injection attacks.

But that's not the real problem here. Here, you are passing your
connection and transaction object to your data layer. The problem with this
is that those objects both derive from MarshalByRefObject. This means that
a proxy is passed to your data layer and any calls to methods/properties on
the connection/transaction are being made back to your machine.

What you really should be doing is handling this in process. You aren't
gaining anything by sending it to another machine, since you are opening the
connection on yours.

Either that, or have the data layer construct the connection.

However, that doesn't solve the issue you have with managing the
transaction. In reality, you need to make the operation that you are
performing transactional. There are a few ways of doing this.

The first would be to use .NET 2.0 and use the TransactionScope class to
encapsulate the transaction scope. The second would be to create a COM+
component through the classes in the System.EnterpriseServices namespace.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Ryan H" <rh******@smci.comwrote in message
news:e%****************@TK2MSFTNGP03.phx.gbl...
Hi,

My data access layer for my VB.NET 1.1 application resides on a different
server and is accessed via Remoting.

Is there a way to configure my data access layer so that I can use
Transactions? For example, I would like to do the following from the
client:

Try
DataAccessLayerClass.RunSQL("UPDATE MyTable SET Column3 = "aa", ConnObj,
TransactionObj)
SendEmail()
TransactionObj.Commit
Catch
' Update or sending of email failed
TransactionObj.Rollback
End Try

Any help on how to use Transactions while the data access layer is
accessed via Remoting would be appreciated.
I am also open to rewriting my current code (i.e. change data access
location) if there is an alternative solution.

Thanks.

Aug 2 '06 #2
Hello Ryan,

RHMy data access layer for my VB.NET 1.1 application resides on a
RHdifferent server and is accessed via Remoting.
RH>
RHIs there a way to configure my data access layer so that I can use
RHTransactions? For example, I would like to do the following from the
RHclient:

You need to use Transaction attribute, it available from EnterpriseServices
namespace

RHAny help on how to use Transactions while the data access layer is
RHaccessed
RHvia Remoting would be appreciated.

AFAIK, there could be a problem if u use COM+, because context that take
a part in DTC can be send across network only via DCOM, not remoting

---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
Aug 2 '06 #3
Michael,

Using the Transaction attribute won't work outside of COM+, so if he is
going to go this route, he has to go through Enterprise Services.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Michael Nemtsev" <ne*****@msn.comwrote in message
news:9c**************************@msnews.microsoft .com...
Hello Ryan,

RHMy data access layer for my VB.NET 1.1 application resides on a
RHdifferent server and is accessed via Remoting.
RHRHIs there a way to configure my data access layer so that I can use
RHTransactions? For example, I would like to do the following from the
RHclient:

You need to use Transaction attribute, it available from
EnterpriseServices namespace

RHAny help on how to use Transactions while the data access layer is
RHaccessed
RHvia Remoting would be appreciated.

AFAIK, there could be a problem if u use COM+, because context that take a
part in DTC can be send across network only via DCOM, not remoting

---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do
not cease to be insipid." (c) Friedrich Nietzsche


Aug 2 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: bettervssremoting | last post by:
To view the full article, please visit http://www.BetterVssRemoting.com Better VSS Remote Access Tool This article makes a detailed comparison among SourceAnyWhere, SourceOffSite, VSS...
5
by: mayamorning123 | last post by:
A comparison among six VSS remote tools including SourceOffSite , SourceAnyWhere, VSS Connect, SourceXT, VSS Remoting, VSS.NET To view the full article, please visit...
0
by: bettervssremoting | last post by:
To view the full article, please visit http://www.BetterVssRemoting.com Better VSS Remote Access Tool including SourceOffSite, SourceAnyWhere and VSS Remoting This article makes a detailed...
11
by: Mike P | last post by:
I've been using C# transactions for a while and had no problems with them. Using try catch blocks I can trap basically all possible errors and rollback all necessary data. Over the last few...
0
by: bettervssremoting | last post by:
To view the full article, please visit http://www.BetterVssRemoting.com Better VSS Remote Access Tool This article makes a detailed comparison among SourceAnyWhere, SourceOffSite, VSS...
0
by: Martijn Damen | last post by:
Hi, At the moment I am trying to develop an application that uses another app over .net remoting and having some problems with it (ok, that is ofcourse why I am here), hope somebody can shine a...
8
by: Raju Joseph | last post by:
Hi All, I am just trying to get an opinion here. I know this is always a tough choice to make. We are in the process of converting our VB6 based Healthcare Information System (a full-fledged...
1
by: Ryan H | last post by:
Hi, My application is written in VB.NET and has a data access layer that resides on a different server and is accessed via Remoting. Currently, when performing an update to the database, I...
3
by: Ryan H | last post by:
Hi, My data access layer for my VB.NET 1.1 application resides on a different server and is accessed via Remoting. Is there a way to configure my data access layer so that I can use...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.