473,401 Members | 2,125 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,401 software developers and data experts.

How to make two WCF services in a transaction

I am new to WCF, so please point me to the right direction.

I created 2 WCF serivces, each one uses a difference database connection in
the back end.
Now from the client application, I need to keep two methods call to the
service in one transaction.
using (TransactionScope scope = new TransactionScope())
{
using (Proxy1 proxy = new Proxy1())
{
proxy.Method1();
}
using (Proxy2 proxy = new Proxy2())
{
proxy.Method2();
}
scope.Complete();
}

Above code does not work. If there is exception in Method2, Method1 still
commit.

What will be the right way to make transcation across multiple WCF services?
Thanks
Feb 8 '08 #1
2 1828
one solution (although not using transactions) would be to check the return
value from each method and proceed to the next only if the previous returned
true and commit only if both/all return true

--
Misbah Arefin
"John Dow" <jo**@hotmail.comwrote in message
news:O6**************@TK2MSFTNGP04.phx.gbl...
I am new to WCF, so please point me to the right direction.

I created 2 WCF serivces, each one uses a difference database connection
in the back end.
Now from the client application, I need to keep two methods call to the
service in one transaction.
using (TransactionScope scope = new TransactionScope())
{
using (Proxy1 proxy = new Proxy1())
{
proxy.Method1();
}
using (Proxy2 proxy = new Proxy2())
{
proxy.Method2();
}
scope.Complete();
}

Above code does not work. If there is exception in Method2, Method1 still
commit.

What will be the right way to make transcation across multiple WCF
services? Thanks

Feb 13 '08 #2
try DependentTransaction object

The DependentTransaction is a clone of a Transaction object created using
the DependentClone method. Its sole purpose is to allow the application to
come to rest and guarantee that the transaction cannot commit while work is
still being performed on the transaction (for example, on a worker thread).

When the work done within the cloned transaction is finally complete and
ready to be committed, it can inform the creator of the transaction using the
Complete method. Thus you can preserve the consistency and correctness of
data.

The DependentCloneOption enumeration is used to determine the behavior on
commit. This behavior control allows an application to come to rest, as well
as provides concurrency support.

--
Misbah Arefin

https://mcp.support.microsoft.com/profile/MISBAH.AREFIN
http://www.linkedin.com/in/misbaharefin
"Misbah Arefin" wrote:
one solution (although not using transactions) would be to check the return
value from each method and proceed to the next only if the previous returned
true and commit only if both/all return true

--
Misbah Arefin
"John Dow" <jo**@hotmail.comwrote in message
news:O6**************@TK2MSFTNGP04.phx.gbl...
I am new to WCF, so please point me to the right direction.

I created 2 WCF serivces, each one uses a difference database connection
in the back end.
Now from the client application, I need to keep two methods call to the
service in one transaction.
using (TransactionScope scope = new TransactionScope())
{
using (Proxy1 proxy = new Proxy1())
{
proxy.Method1();
}
using (Proxy2 proxy = new Proxy2())
{
proxy.Method2();
}
scope.Complete();
}

Above code does not work. If there is exception in Method2, Method1 still
commit.

What will be the right way to make transcation across multiple WCF
services? Thanks
Feb 25 '08 #3

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

Similar topics

4
by: bob garbados | last post by:
I'm new to web services and I'm trying to interface with a payment gateway for an online store. I'm trying to do this without Visual Studio and I'm stuck... I created my proxy class from the...
3
by: Luc | last post by:
Hi everyone, I had this strange problem. We are using web services for our entreprise applications. We are using IIS as the host for our webservices and IIS is configured to use integrated...
6
by: Simon Harvey | last post by:
Hi everyone, We have a need to make a Windows Forms (2.0) client application that will be installed on our clients site. The data that the application uses needs to be centrally available to a...
4
by: LoveLorn | last post by:
how can i make my node info in linked list as an object of another class f.e i want to make my node data as a person information like name , surname , date of birth and job . can any one help me plz
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.