I have had to implement similar functionality on several projects, the simplest way I have found to do it is this (from memory, but I think this is going to work):
var dbUsernames = context.Database.SqlQuery<string>("SELECT UserName FROM UserProfile");
foreach (string dbUsername in dbUsernames)
{
string[] userRoles = Roles.GetRolesForUser(dbUsername);
if (userRoles != null && userRoles.Length > 0)
{
Roles.RemoveUserFromRoles(dbUsername, userRoles);
}
int userId = context.Database.SqlQuery<int>("SELECT UserId FROM UserProfile WHERE UserName = {0}", dbUsername).First();
// HERE: Delete any other dependent rows in other tables that use UserId, and have referential integrity
// Now tear down any final bits and delete the user, for example:
Membership.DeleteUser(dbUsername, true);
context.Database.ExecuteSqlCommand(
"DELETE FROM webpages_Membership WHERE UserId = {0}", userId);
}