GetMembershipUser Helper Method for Entity Framework MVC3 Razor Custom Member Provider C# Using LINQ

From my C# MVC3 Razor Custom Membership Provider article and source code, here is the code for the GetMembershipUser Helper method. I welcome any suggestions for improvement. Since we are working with a UserProfile Entity and the Membership Provider overridable methods require we return a MembershipUser type, below we create our MembershipUser type using values from our UserProfile type so we can return the required type in our methods.
// helper method
public MembershipUser GetMembershipUser(UserProfile u)
    // copy pertinent UserProfile data to the MembershipUser 
// data to be returned as a MembershipUser type object userIDObj = u.UserId; MembershipUser membershipUser = new MembershipUser( this.Name, u.UserName, userIDObj, u.Email, string.Empty, string.Empty, true, false, (DateTime)u.DateCreated, (DateTime)u.DateLastLogin, (DateTime)u.DateUpdated, (DateTime)u.DateLastLogin, (DateTime)u.DateLastLogin); return membershipUser; }


No Comments