.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

WCF Async method inside a WCF transaction

Posted By:      Posted Date: September 28, 2010    Points: 0   Category :WCF

Can WCF async methods be called  from within a WCF transaction?

Normally, one would only call synchronous methods from within a WCF transaction.

View Complete Post

More Related Resource Links

How to create a second independent transaction inside a CLR stored procedure?

I use the context connection for the "normal" work in the CLR procedure.But I need to commit some data in every case. So I need to create a second transaction which is independent from the calling transaction.What is the best way to do this inside a CLR procedure?Thanx a lot

SSIS For Each loop with data flow hangs on DTC (SID -2) when inside transaction

The short story: I have a data flow inside a For Each container that is inside a sequence container.  A transaction is established at the sequence container, with Isolation Level Serializable.  The For Each container is limited to execute only 4 iterations.  The data flow iterates once fine, but the second iteration hangs.  The Activity Monitor shows the process is waiting on a another process with a SID of -2.  From other research in the past, I have found that this is an internal process dedicated to DTC (Distributed Transaction Coordinator). Environment: Microsoft SQL Server 2005 (SP3) on Windows 2008 R2 Standard.  I'm using SQL Server BIDS 2005 for building these packages.  I also have SQL Server 2008 installed and the databases are installed there. The details: The data flow merges data from the same table in two databases, source and target, using a Merge Join component.  It then performs a few transformations and lookups from other tables in the target DB to get IDs.  Then it inserts new records into the target DB or updates existing records in the target DB.  The two source tables are using OLE DB Source components with customized queries.  The insert target component is an OLE DB Destination and the update target component is an OLE DB Command.  In this particular scenario,

Running async WCF methods within a WCF transaction?


Can someone please tell me what is the correct way of calling async methods from within a WCF transaction?

Normally, one would only call synchronous methods from within a WCF transaction.


MySql Transaction inside a loop.


Hi.  I'm trying to delete a bunch of records in mysql.  The record info to delete (userid, name) is stored in an arraylist.  It seems to only delete the first record and gives an error ("Transaction has already been rolled back or is not pending.") afterwards.  I have the transaction commit inside the loop which I think is the issue but not sure how to go further if I bring it outside of the loop.  Here's the relevant bits of the code.  Thanks in advance.

                ArrayList alist = new ArrayList();

                //alist gets populated with data like (12345,robot)(23456,car) here.

                    MySqlConnection conn2 = new MySqlConnection(query_connection);

dynamic javascript of an .ascx control inside an updatepanel not changing on client between async po


I have a confusing state issue. I found a way around it, but I would like to know why this is happening. First of all, I am using .NET 3.5 and that can't change right now (an easy fix may be the fixed ID capabilities of .NET 4.0).

Type csType = this.GetType();
ClientScriptManager cs = Page.ClientScript;
string jScriptBlockName = "SignUpSignInNameAvailabilityScript";
if (!cs.IsClientScriptBlockRegistered(csType, jScriptBlockName))
{   //NOTE: verified code always enters this
    StringBuilder cstext2 = new StringBuilder();
    cstext2.Append("function GetSignUpSignInNameAvailabilityMessage() { var id = '"
          + CreateUserWizardStep1.ContentTemplateContainer.FindControl("iSignUpSignInNameAvailabilityMessage").ClientID
          + "'; alert(id); return id; }");
    cs.RegisterClientScriptBlock(csType, jScriptBlockName, cstext2.ToString(), true);

This code is in Page_Load of an ascx. The same control is drawn on two separate postbacks of an UpdatePanel in different places of the page thus giving them different client IDs. The code works correctly on the first refresh of web browser; but after UpdatePanel

How to rollback transaction in wcf method if CommunicationException occured?



I have a simple wcf-service (wsHttpBinding) hosted in IIS which inserts data into database and returns number of inserted records and collection of errors (such as foreign key problems while inserting the data).

int ProcessCustomers(Customer[] customers, out ErrorLog[] errorLog)
This is a implementation:
public int ProcessCustomers(Customer[] customers, out ErrorLog[] errorLog)
 using (var tran = new TransactionScope())
 //insert data into database
 return cnt;

 And i have a very simple wcf-client which invokes this method and trying to catch exceptions.

 int inserted = client.ProcessCustomer(customers, out errorLogs);
catch (TimeException timeEx)
 //write to log
catch (FaultException faultEx)
 //write to log
catch (CommunicationException commEx)
 //write to log
catch (Exception ex)
 //write to log

//close the proxy

modifiying value inside a lambda method


I have a class that does some value calculations on a list of items and present it to a chart.  The list of items has somewhere around 40 nullable items in it.  It also contains a datetime value.  Prior to presenting it to a the chart I need to nullify some items in the list that are beyond a specific date.  The problem is that the properties that need to be nullified vary based upon the type of chart being rendered.

This is currently all handled in a loop inside the chart that says for each item in the loop, nullify property a, b, c, etc, if it's beyond date x.

Because these rules seem to be changing often, I though about creating a simple lambda / function to handle this.

inside my calculations class I have this:

public void NullifyFutureData(Func<T, decimal?> selector) 
// Where T is a base class that the calculator class 
//has to dervice from which will always have specific properties
    foreach (var item in this._list)
        if (item.DataDate > this._dataDate)
            selector(item).Value = null;

which in theory should allow me to do this:

_calculator.NullifyFutureData(e => e.myfield_a4);
_calculator.NullifyFutureData(e => e.myfield_a6);

But of course, I get

SQL dynamic query inside BEGIN Transaction


Hi All,

I am working on stored procedure and all update statements are inside "BEGIN TRAN" and COMMIT..now i expect if all statement runns succesfully then to return 1 else from catch block it should return error message..

i wrote stored procedure mentioned below ...

when i execute this stored procedure i see three output ..including return value..


-- =============================================
-- Author:		<>
-- Create date: <19 March 2010>
-- Description:	<Update FPA_CLAIM_MAN ,FPA_CLAIM_DETAIL ,
-- =============================================
ALTER PROCEDURE [dbo].[SP_UpdateFpaByFiAdmin](
	-- Add the parameters for the stored procedure here
	@COMMENT VARCHAR(1000) = ' ',
	@TOTA_CLAIM_AMT bigint,

	@bu_ecode VARCHAR(20),

	@total_bal bigint ,

	@STRING_Employee_Limit_distribution  VARCHAR(MAX) = '',
	@STRING_Employee_FPA_distribution  VARCHAR(MAX) = ''


Thinking about new C# method prototypes: object as dictionary

I recently had to write a small Flickr API. I know many .Net API for Flickr already exist but I needed one for a Silverlight application. Whatever, it's only about building some querystrings so I did it by myself. It's been an opportunity to think again about a classical question: how to pass parameters to a method ?

Imagine you have a generic method to call some Flickr functions.

Accessing the different controls inside a GridView control

how we can access a particular control which resides inside a GridView control. In this article I will show you how you can access different controls inside a GridView control. We will see how we can access a TextBox control, a DropDownList control and a ListBox control. If you are working with ASP.NET 1.X then you might want to check out my article Accessing Different Controls Inside a DataGrid.

How To Add calendar control inside a GridView

This article show hot to add calendar control inside a GridView with code in c#

Using ATLAS PopUp Control with Calendar inside the GridView Control

In this video tutorial Mohammad demonstrates how you can access the Calendar control which is displayed using the ATLAS PopUp control inside the GridView control.

RadioButton inside GridView, How to get it work as normal

Did you tried before to drag a RadioButton control inside a Gridivew templatefield, and then you attempt to select these RadioButtons , you will notice that the behavior of RadioButton control will be changed and it will work just like the behavior of checkbox control! the user will be able to select more than one radiobutton in the grid!

Maintain HTML Radio Button Selection Inside GridView After Postback

Long time ago I wrote an article about getting the value of the selected RadioButtons inside the GridView control. The code did not addresssed the postback issue which means that the selected radio button was cleared after the postback occurs.

SQL Server Database Transaction

A transaction is a group of SQL commands executed together as a single component of work to be accomplished. If all of these commands succeed, then a transaction is committed - the changes to the data are made final. If any of the commands within a transaction fail, then the entire transaction is cancelled, or in SQL Server terms, the transaction will be rolled back.

Transactions are one of the things that keep your data safe, but they're not necessarily easy to understand. Here's some help:

LinkButton inside Repeater



I have Repeater, which consists of LinkButon and Literal. LinkButon and Literal are whole thing by implication. I want get value from Literal, when user click on corresponding LinkButton.


Textbox in ItemTemplate inside Gridview, unable to get the value


Hi. I have a itemtemplate inside a gridview.

<asp:TemplateField HeaderText="Enter OTP">
                            <asp:Label ID="Label2" runat="server"
                                style="font-family: Arial, Helvetica, sans-serif; font-size: x-small"
                                Text="PIN Num:"></asp:Label>
                            &nbsp;<asp:TextBox ID="txtPIN" runat="server" Height="21px" Width="100px"></asp:TextBox>

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend