예제 #1
0
        public override int DeleteProfiles(ProfileInfoCollection profiles)
        {
            var rowsAffected = 0;

            try
            {
                if (profiles.Count < 1)
                {
                    throw new ArgumentException("The collection parameter 'profiles' should not be empty.", "profiles");
                }

                var usernames = profiles
                                .Cast <ProfileInfo>()
                                .Select(x => x.UserName)
                                .ToArray();

                rowsAffected = DeleteProfiles(usernames);
            }
            catch (SQLiteException ex)
            {
                if (!WriteExceptionsToEventLog)
                {
                    throw;
                }
                EventLogger.WriteToEventLog(ex, "DeleteProfiles(ProfileInfoCollection)");
            }

            return(rowsAffected);
        }
예제 #2
0
 public override int DeleteProfiles(ProfileInfoCollection profiles)
 {
     return(DeleteProfiles(profiles
                           .Cast <ProfileInfo>()
                           .Select(profile => profile.UserName)
                           .ToArray()));
 }
        public override int DeleteProfiles(ProfileInfoCollection profiles)
        {
            if (!this.Initialized || this.ReadOnly)
            {
                return(0);
            }
            string[] usernames = (from profile in profiles.Cast <ProfileInfo>() select profile.UserName).ToArray <string>();

            return(this.DeleteProfiles(usernames));
        }
예제 #4
0
        /// <summary>
        /// When overridden in a derived class, deletes profile properties and information for the supplied list of profiles.
        /// </summary>
        /// <param name="profiles">A <see cref="T:System.Web.Profile.ProfileInfoCollection"></see>  of information about profiles that are to be deleted.</param>
        /// <returns>
        /// The number of profiles deleted from the data source.
        /// </returns>
        public override int DeleteProfiles(ProfileInfoCollection profiles)
        {
            if (profiles == null)
            {
                throw new ArgumentNullException(nameof(profiles));
            }

            IEnumerable <string> profilesToDelete = profiles.Cast <ProfileInfo>().Select(p => p.UserName);

            return(DeleteProfiles(profilesToDelete.ToArray()));
        }
예제 #5
0
        public override int DeleteProfiles(ProfileInfoCollection profiles)
        {
            var count = 0;

            Parallel.ForEach(profiles.Cast <ProfileInfo>(), profile =>
            {
                if (DeleteProfile(profile.UserName, profile.IsAnonymous))
                {
                    Interlocked.Increment(ref count);
                }
            });
            return(count);
        }
예제 #6
0
        public override int DeleteProfiles(ProfileInfoCollection profiles)
        {
            Condition.Requires(profiles, "profiles").IsNotNull();

            int i;

            using (var db = this.ConnectToDatabase())
            {
                DeleteUserInRoles(db, profiles);
                DeleteOAuthMembership(db, profiles);
                DeleteMembership(db, profiles);
                i =
                    profiles.Cast <ProfileInfo>()
                    .Sum(profile => db.Execute(this.sqlQueryBuilder.DeleteProfile, profile.UserName));
            }

            return(i);
        }
예제 #7
0
 private void DeleteUserInRoles(IDatabase db, ProfileInfoCollection profiles)
 {
     this.DeleteUserInRoles(db, profiles.Cast <ProfileInfo>().Select(x => x.UserName).ToArray());
 }
예제 #8
0
 private void DeleteOAuthMembership(IDatabase db, ProfileInfoCollection profiles)
 {
     this.DeleteOAuthMembership(db, profiles.Cast <ProfileInfo>().Select(x => x.UserName).ToArray());
 }