system.transactions

G

Guest

I have a problem using system.transactions ...it doesnt have a transaction
Class unitofwork....
public override void Commit()
{
using (TransactionScope scope = new TransactionScope())
{
Application.ConnectionManager.OpenConnection();
InsertNew();
updateDirty();
deleteRemoved();

//Application.ConnectionManager.CloseConnection();

scope.Complete();
}
 
R

Richard Blewett [DevelopMentor]

Are you saying that Transaction.Current is null? or are you saying that InsertNew, upxateDirty and deleteRemoved aren't being executed as part of the same physical transaction?

What is happening in those 3 methods?

You need to give us more information

Regards

Richard Blewett - DevelopMentor
http://www.dotnetconsult.co.uk/weblog
http://www.dotnetconsult.co.uk

I have a problem using system.transactions ...it doesnt have a transaction
Class unitofwork....
public override void Commit()
{
using (TransactionScope scope = new TransactionScope())
{
Application.ConnectionManager.OpenConnection();
InsertNew();
updateDirty();
deleteRemoved();

//Application.ConnectionManager.CloseConnection();

scope.Complete();
}
 
G

Guest

thanks for the reply...I am taking your valuable time.


the thing is when I do the exapmples of system.transactions everything works
fine

But .we have a 3 tier architecture and we have placed our
unitofWork(martinfowler) class in the data access layer.
But the way we use it is over "Seperated interface"(Martin fowler).

when we call insertnew the operations doesnt wait till the
scope.complete();the inserts into database happen without our control.

Do u know why?

Thanks

PS:Do u think this will work ?I did not fully understand the code below.
class MyRemoteObject : MarshalByRefObject
{
public void DoWorkInTransaction(ITransaction transaction)
{
using(TransactionScope ts = new TransactionScope(transaction))
{
// Do some work here...
ts.Consistent = true;
}
}
}


class MyClientObject
{
MyRemoteObject remoteObject;


public void DoTransactionalWork()
{
using(TransactionScope ts = new TransactionScope())
{
this.remoteObject.DoWorkInTransaction(Transaction.Current);
ts.Consistent = true;
}
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top