how to set Transaction scope in c#?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rsreddyk
    New Member
    • Jul 2012
    • 1

    how to set Transaction scope in c#?

    I have c# code something like below.
    [code=C#]

    void ExecuteSomethin g()
    {
    TransactionOpti ons transactionOpti ons = new TransactionOpti ons();
    transactionOpti ons.IsolationLe vel = System.Transact ions.IsolationL evel.ReadUncomm itted;
    transactionOpti ons.Timeout = TimeSpan.FromSe conds(Transacti onTimeOutInSeco nds);

    using (TransactionSco pe transactionScop e = new TransactionScop e(TransactionSc opeOption.Requi red, transactionOpti ons))
    {
    action();
    transactionScop e.Complete();
    }
    }

    [/code]

    i am retrieving the data by using above code

    From some other code i am calling some function in c# through windows service. That function is going to delete some unwanted data from sql server database. if i wanted i initiate the request it will take 30 min to delete the data.

    in this 30 min time i am unable to access other pages in my website. is there any better way to design this?
    Last edited by Plater; Jul 2 '12, 03:34 PM. Reason: code tags
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    So this is being done on the webserver? Hmm I think you can still use threads right?
    I have never done it, but long running tasks like are usually implimented in a way where you have a unique token that references the "job" and you can keep refreshing the page to find out if it is complete.
    You could look up ways to handle that sort of thing, there might be a good explanation of it somewhere

    Comment

    • frenchmarlohe
      New Member
      • Aug 2012
      • 1

      #3
      Get the current value of the first element in the set of matched elements.You need to specify in the script which field you want to use as an input field. Assuming it's HORAS2, then the script will be och.

      Comment

      Working...