2

Regarding the ASP.NET Universal Providers (System.Web.Providers), do they automatically offer the retry logic when used with SQL Azure? For example in my code I call:

Membership.CreateUser

If that fails because of a Azure's transient error, does the library automatically handle the situation and retry the operation? Or should I manually handle the exception + do the retry?

The following question implies that the reply logic is built-in, but is there a place where I could confirm this, like some home page of these providers or the source code?

Community
  • 1
  • 1
Mikael Koskinen
  • 12,306
  • 5
  • 48
  • 63

1 Answers1

2

I don't see anywhere it retries again after fail. DefaultMembershipProvider uses simple entity framework AddObject, unless you implement CustomMembershipProvider.

internal static User CreateUser(MembershipEntities ctx, Guid id, 
   string userName, Guid appId, bool isAnon)
{
   User user = new User();
   user.UserId = id;
   user.ApplicationId = appId;
   user.LastActivityDate = DateTime.UtcNow;
   user.UserName = userName;
   user.IsAnonymous = isAnon;
   ctx.Users.AddObject(user);
   User user1 = user;
   return user1;
}
Win
  • 61,100
  • 13
  • 102
  • 181
  • So how the heck is this truly 'supporting' Azure SQL Database then? I was successfully using the old provider against SQL Database for 18 months with no problems other than lack of retry logic. I migrated to the new universal provider 6 months ago because I assumed it had retry logic for Azure. Now I am baffled as to why I am using it. – BrettRobi Oct 18 '13 at 23:25
  • @BrettRobi Supporting SQL Azure and retrying logic are two different issues. Universal Providers supports SQL Azure right out of the box which legacy Membership provider has failed. I agree that retry logic should be included by default. However, if we want the retry logic, we might want to ask at feature request form. – Win Oct 20 '13 at 04:48
  • I disagree. The old provider "supported" SQL Azure in your terms. The new one offers no benefit for me if there is no retry logic. SQL Azure is "substantially" (to use an Azure phrase) SQL Server, the need for retry logic is a core difference between the two. Regardless, thanks for the comment. – BrettRobi Oct 20 '13 at 13:37
  • @BrettRobi Old Membership Provider doesn't support SQL Azure, because it uses aspnet_regsql.exe to create database with correct schema. **You'll have to modify them in order to host in SQL Azure.** However, new universal provider use **Entity Framework Code First** and creates the database automatically the first time you use it. ***It is one of the benefit of New Universal Provider over old one.*** *If you have more questions regarding the comparison, please kindly create a new question.* – Win Oct 20 '13 at 15:43