Monday

linq transactions support/Charp/dot.net 3.5

 [Test]
public void StoredProcedure_and_LinqUpdates_Test()
{

// dx is datacontext instance
dx.Connection.Open();
dx.Transaction = dx.Connection.BeginTransaction();


// calling stored procedure from linq here
var result = dx.PaymentServices_ApplyPaymentToAccount(89);


// updating objects from context
Invoice i = customerService.getInvoice(277);

i.DueDate = Convert.ToDateTime("11/5/2008");

// submitting changes and committing transaction
dx.SubmitChanges();
dx.Transaction.Commit();


// rollback transactions and
// no changes made in object or by stored procedure will be stored
dx.Transaction.Rollback();

}

more...

No comments:

test smtp server with powershell

Send-MailMessage -SMTPServer smtp.domain.com -To [email protected] -From [email protected] -Subject "This is a test email" -Body ...