title: How can I reference my own table with the MVC Controller.User property?
body: <p>With the default membership provider for MVC 2 projects, I can reference <code>User.Identity.UserName</code> as per whatever it creates by default. I don't want to do this--want to use my own tables. So, I implemented the System.Web.Security.MembershipProvider class. The only thing I've implemented, as per many posts on the web and SO, is <code>ValidateUser(string username, string password)</code></p>
  
  <p>I can easily see this accepts username and password strings, I access my database context (LINQ to Entities, actually the dotConnect provider for MySQL), and check the username and password--simple enough.</p>
  
  <p>But, how can I make the Controller.User object use the properties of my own table. For example, my table is called Staff. It has StaffID (PK), FirstName, LastName, etc. How can I access the StaffID of the current contextual user as follows?</p>
  
  <pre><code>int id = User.StaffID;
  </code></pre>
  
  <p>I found this post by Matt Wrock, but I can't really make sense of implementing the User class, specifically the IsInRole method. When is this object constructed, and where do the constructor arguments come from?</p>