This project is read-only.
In this membership implementation, all data is saved in User table. For example you need to add to it fields:
-FirstName
-LastName
-Email

You need to create class that contains all requried fields and inherit it from "MembershipAccountBase":
    public class SampleUserProfile : MembershipAccountBase
    {
        public string Email { get; set; }
        public string FirstName { get; set; }
        public string LastName { get; set; }
    }


Then you need to create UserProfileService and inherit from "UserProfileServiceBase":
    public class DefaultUserProfileService : UserProfileServiceBase<SampleUserProfile>
    {
        public DefaultUserProfileService(string connectionString)
            : base(connectionString)
        {

        }
    }


Now you are ready to go. Using DefaultUserProfileService you can CRUD for users profile data. But remember all data are persisted in one users collection.

Example of using:
string connectionString = ConfigurationManager.ConnectionStrings["mongodb"].ConnectionString;
DefaultUserProfileService service = new DefaultUserProfileService(connectionString);
SampleUserProfile profile = new SampleUserProfile();
profile.UserName = model.UserName;
profile.FirstName = "Dima";
profile.LastName = "Hohlov";
service.CreateProfile(profile);

connectionString must be in format: mongodb://{server}/{databaseName}

Last edited Jan 29, 2013 at 1:00 AM by F0rc0sigan, version 1

Comments

No comments yet.