//
        // RoleProvider.GetAllRoles
        //

        public override string[] GetAllRoles()
        {
            var parameters = new MySqlParameter[0];
            var collection = new List <string>(32);
            int totalRecords;
            Action <MySqlDataReader> cnt = reader =>
            {
                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        collection.Add(reader.GetString("name"));
                    }
                }
            };

            _helper.ExecuteMySqlReader3("SELECT SQL_CALC_FOUND_ROWS R.`name` FROM `Roles` R;", parameters, cnt, out totalRecords);

            return(collection.ToArray());
        }
Пример #2
0
        //
        // MembershipProvider.GetAllUsers
        //

        public override MembershipUserCollection GetAllUsers(int pageIndex, int pageSize, out int totalRecords)
        {
            var parameters = new[] {
                new MySqlParameter("?offset", pageSize * pageIndex),
                new MySqlParameter("?count", pageSize)
            };
            var collection = new MembershipUserCollection();
            int totalUsers;
            Action <MySqlDataReader> cnt = reader =>
            {
                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        collection.Add(GetUserFromReader(reader));
                    }
                }
            };

            _helper.ExecuteMySqlReader3("SELECT SQL_CALC_FOUND_ROWS * FROM `Users` ORDER BY `userName` LIMIT ?offset, ?count;", parameters, cnt, out totalUsers);
            totalRecords = totalUsers;
            return(collection);
        }