I've been playing with various versions of this for several years: 1) Does the membershipprovider handle transient connection failures to SQL Azure (or for that matter, any other storage provider (tables, blobs, etc)? 2) Why are the stored procedures that used to exist gone? I prefer SP for what should be obvious reasons.
Asked
Active
Viewed 80 times
2 Answers
0
I can tell you about SPs. The DefaultMembershipProvider it seems now uses EF (or may...be ADO.Net). This is what i found in System.Web.Providers.DefaultMembershipProvider
class
internal static IQueryable<DbDataRecord> GetAllMembershipUsersLikeUserName(MembershipEntities ctx, string applicationName, string userName, int pageIndex = -1, int pageSize = -1)
{
string queryString = QueryHelper.AppendUserNameSkipLimitIfNeeded("select u.UserName, u.UserId, m.Email, m.PasswordQuestion, m.Comment, m.IsApproved, m.IsLockedOut, m.CreateDate, m.LastLoginDate, u.LastActivityDate, m.LastPasswordChangedDate, m.LastLockoutDate FROM Users as u, Memberships as m, Applications as a WHERE ToLower(a.ApplicationName) = @appName AND a.ApplicationId = m.ApplicationId AND m.UserId = u.UserId AND ToLower(u.UserName) LIKE @userName", pageIndex, pageSize);
return (IQueryable<DbDataRecord>) ctx.CreateQuery<DbDataRecord>(queryString, new ObjectParameter("appName", (object) applicationName.ToLowerInvariant()), new ObjectParameter("userName", (object) userName.ToLowerInvariant()));
}
With standard CRUD query i don't see your point of using SP as there would be not much different in performance even if there is any.
I am here talking about the Universal Providers, some details here

Chandermani
- 42,589
- 12
- 85
- 88
-
My interest in SP is twofold: restrict what SQL user can do what by granting execute privileges, etc, and to avoid SQL injection by parameterizing. Turns out that both are handled inside the provider, and I believe transient fault handling is as well. – Tim Lacy Sep 18 '13 at 10:18
0
It turns out that aside from the SP question, the DefaultMembershipProvider doesn't support transient fault handling, but there is a way...
SO question here
has the answer: Create a new provider, inherit from the default provider, set that as the default provider, and there you go:
public override MembershipUser CreateUser(string username, string password, string email, string passwordQuestion, string passwordAnswer, bool isApproved, object providerUserKey, out System.Web.Security.MembershipCreateStatus status)
{
MembershipCreateStatus tempstatus = 0;
var something = retryPolicy.ExecuteAction(() =>
{
return base.CreateUser(username, password, email, passwordQuestion, passwordAnswer, isApproved, providerUserKey, out tempstatus);
});
status = tempstatus;
return something;
}