Hi.
I am having problems. I have a subclass based on Randy Patterson's fluent interface example here:
Randy Patterson's Fluent Interface Design Page
I am subclassing a User class and need to pass the properties set in it to the below CreateNewUser method within the UserFluentInterface subclass.
public void CreateNewUser()
              {
                    try
                    {
                        User user = (User)_User;
                        MembershipCreateStatus status;
                        MembershipUser memuser = _membership.CreateUser(user, out status);
                    }
                    catch (Exception e)
                    {
                        string message = e.Message;
                    }
                }
and _membership.CreateUser has the signature:
public MembershipUser CreateUser(User user, out MembershipCreateStatus status);
I am getting the error:
Cannot access a non-static member of outer type 'MyProject.Schema.User' via nested type 'MyProject.Schema.User.UserFluentInterface'
I am not sure how resolve this. Code is as follows:
User user = _someAPI.GetUserProfile(txtEmail.Text);
user.Set
  .Email(txtEmail.Text)
  .Password(txtPassword.Text)
  .CreateNewUser();
Now, I have a User class with a subclass:
 public class User : ProfileBase, ISessionMgrEntry
    {
        MyMembershipProvider _membership = null;
        UserFluentInterface _set = null;
        public User()
        {
            _membership = (MyMembershipProvider)Membership.Providers["MyMembershipProvider"];
            _set = new UserFluentInterface(this);
        }
        public UserFluentInterface Set
        {
            get { return _set; }
        }
        #region ProfileBase Members
            [SettingsAllowAnonymous(false), CustomProviderData("Email;string")]
            public string Email { get { return base["Email"] as string; } set { base["Email"] = value; } }
[SettingsAllowAnonymous(false), CustomProviderData("Password;string")]
            public string Password { get { return base["Password"] as string; } set { base["Email"] = value; } }
           public class UserFluentInterface
            {
                private readonly User _User;
                public UserFluentInterface(User User)
                {
                    _User = User;
                }
                public UserFluentInterface Email(string email)
                {
                    _User.Email = email;
                    return this;
                }
                public UserFluentInterface Password(string password)
                {
                    _User.Password = password;
                    return this;
                }
                public void CreateNewUser()
                {
                    try
                    {
                       User user = ???? // HOW DO I ACCESS THE PROPERTIES THAT WERE ORIGINALLY SET AND PASS THEM AS AN OBJECT BELOW?                        
                        MembershipUser memuser = _membership.CreateUser(user);
                    }
                    catch (Exception e)
                    {
                        string message = e.Message;
                    }
                }
            }
       }