Jump to content
View in the app

A better way to browse. Learn more.

Andhrafriends.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
Our forum software has been upgraded to the latest version and we are currently experiencing temporary technical issues. Our server administrator is actively working to resolve them, and the forum should be fully operational within the next few hours. Thank you for your patience and understanding.

.net Db Transaction Help

Featured Replies

Bhayya, I wrote a method that will be doing this 

 

private void method1(List<object>updates)

{

    using (var context = DbFactory.Initialize<DBEntities>())
            {
                using (DbTransaction tx = context.BeginTransaction())
                {
                    //Perform some inserts
                    context.GuardSaveChanges();
                    tx.Commit();
                }
            }
 
    using (var context = DbFactory.Initialize<DBEntities>())
            {
                using (DbTransaction tx = context.BeginTransaction())
                {
                    //Perform some updates
                    context.GuardSaveChanges();
                    tx.Commit();
                }
            }

}

  • Author

Reviwe cheyyamani team ki email chesa,

okadu said this: if first transaction throws an error will id try to go to the second step and do the second transaction ?

if yes then we will get 2 errors kada annadu 

 

is there a better way to code this ?

the reason for 2 transactions is:

first transaction lo oka insert chestunnam, we are passing that value to a different service in the second transaction 

first di commit avvakapote the service is throwing an error (cant fetch value from DB ani)

first daantlo error vasthe second daaniki velladu. it crashes. 

Have Try catch blocks

HELP

first daantlo error vasthe second daaniki velladu. it crashes.
Have Try catch blocks

Using is translated as try catch and will call dispose if an exception occurs.. Exception record cheyyali inkemaina cheyyali ante use try catch finally...

Using is translated as try catch and will call dispose if an exception occurs.. Exception record cheyyali inkemaina cheyyali ante use try catch finally...

good to know. Thanks

just confirming what you just said - 

http://stackoverflow.com/questions/8309877/if-an-exception-happens-within-a-using-statement-does-the-object-still-get-dispo

  • Author

Using is translated as try catch and will call dispose if an exception occurs.. Exception record cheyyali inkemaina cheyyali ante use try catch finally...

Bhayya, here is the code. Is this what you wanted me to do ??

nenu first paste chesina code is called from this originalmethod 

public void originalmethod(updates)

{

try

{

     method1(updates)

}

catch (Exception ex)

            {
ExceptionPolicy.HandleException(ex, "Legacy Exception Policy");
                ServiceLogger.LogError(OpName, ex);
            }
            finally
            {
                LegacyExceptionHelper.ClearExternalServiceRequestsAndResponsesFromThreadContext();
            }

}

Bhayya, here is the code. Is this what you wanted me to do ??
nenu first paste chesina code is called from this originalmethod
public void originalmethod(updates)
{
try
{
method1(updates)
}
catch (Exception ex)
{

ExceptionPolicy.HandleException(ex, "Legacy Exception Policy");
ServiceLogger.LogError(OpName, ex);
}
finally
{
LegacyExceptionHelper.ClearExternalServiceRequestsAndResponsesFromThreadContext();
}
}

Method lo using lopala try catch pettu rather than wrapping the method inside try catch..

Method lo using lopala try catch pettu rather than wrapping the method inside try catch..

Agreed

  • Author

Agreed

first using lo oka try catch and second using lo oka try catch pettala ?

first using lo oka try catch and second using lo oka try catch pettala ?

2 using loo pettali, rendu commit lu vaduthunnav kabatti

Account

Navigation

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.