[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:
Post a Comment