Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Help with Implementing custom MemebershipProvider

Help with Implementing custom MemebershipProvider

Scheduled Pinned Locked Moved ASP.NET
databasebusinesshelpquestionannouncement
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    Taurian110
    wrote on last edited by
    #1

    I needed to implement a custom MembershipProvider cuz we already have a database with user information in it; also I need to get a list of users. In my DAL I have a method that I can call which will populate the business entity and returh a List<>. However since I am using MembershipProvider I thought I should use the Memebership.GetAllUsers() method to do the same.

    Do you think that the following implementation is acceptable or is it a programming NO NO...?

    public override MembershipUserCollection GetAllUsers(int pageIndex, int pageSize, out int totalRecords)
    {
    List<UsersEntity> users = DAL.GetUsers();
    foreach(UserEntity user in users)
    {
    MembershipUser members = new MembershipUser(this.Name,
    user.username,
    user.providerUserKey,/*I dont have this in my database*/
    user.email,
    user.passwordQuestion,
    user.comment,/*I dont have this in my database*/
    user.isApproved,/*I dont have this in my database*/
    user.isLockedOut,
    user.creationDate,
    user.lastLoginDate,
    user.lastActivityDate,
    user.lastPasswordChangedDate,
    user.lastLockedOutDate/*I dont have this in my database*/);

    }
    

    }

    Can you tell me what I need to to do about the fields that I donot have in my database? Do I need to update the database? or should I just pass in a null or String.Empty or something like that? Please help.

    C 1 Reply Last reply
    0
    • T Taurian110

      I needed to implement a custom MembershipProvider cuz we already have a database with user information in it; also I need to get a list of users. In my DAL I have a method that I can call which will populate the business entity and returh a List<>. However since I am using MembershipProvider I thought I should use the Memebership.GetAllUsers() method to do the same.

      Do you think that the following implementation is acceptable or is it a programming NO NO...?

      public override MembershipUserCollection GetAllUsers(int pageIndex, int pageSize, out int totalRecords)
      {
      List<UsersEntity> users = DAL.GetUsers();
      foreach(UserEntity user in users)
      {
      MembershipUser members = new MembershipUser(this.Name,
      user.username,
      user.providerUserKey,/*I dont have this in my database*/
      user.email,
      user.passwordQuestion,
      user.comment,/*I dont have this in my database*/
      user.isApproved,/*I dont have this in my database*/
      user.isLockedOut,
      user.creationDate,
      user.lastLoginDate,
      user.lastActivityDate,
      user.lastPasswordChangedDate,
      user.lastLockedOutDate/*I dont have this in my database*/);

      }
      

      }

      Can you tell me what I need to to do about the fields that I donot have in my database? Do I need to update the database? or should I just pass in a null or String.Empty or something like that? Please help.

      C Offline
      C Offline
      Chetan Ranpariya
      wrote on last edited by
      #2

      Hi, you can provide any value to the fields to the Fields that u dont have in your database or you can leave them blank by assigning null or string.empty or any default value. But be sure that you r not going to use these fields anywhere in your application. I hope this will help you.

      Thanks and Regards, Chetan Ranpariya

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups