views:

157

answers:

2

Is there an API in the ASP.NET membership, implementation to get all user profiles at once. If not, is there another good way to get all the names (first + last) of all the users. I'm trying to avoid the many SQL requests generated by getting the user profiles one at a time.

+3  A: 

ProfileProvider.GetAllProfiles().

I'd still recommend just adding first and last names to the MembershipUser though. You'll need to cast your provider to the concrete type, which is brittle if you ever want to change it.

womp
This will get me the user, but not the first/last name stored in the profile. That will be another separate call for every user. This is what I'm trying to avoid
Ron Harlev
It is in the profile. I'm trying to get all profiles at once. That was my original question
Ron Harlev
@Peter - Love the strawman and trollish tone, but I'll bite. I've taken plenty of downvotes, and when they're warranted I'll happily accept.
womp
+2  A: 

Update:

A challenge with the way profile data is stored is that the property names and values are packed and stored in two columns in the Profile database. If you run the aspnet_Profile_GetProperties sproc you will see that.

There is no out-of-the-box sproc that gets profile data for all users. A quick modification to the aspnet_Profile_GetProperties would do that for you though.

Peter Lillevold