title: Implementing WebSecurity.InitializeDatabaseConnection on MVC app
body: <p>I'm using WebSecurity.InitializeDatabaseConnection('with parameters...') and then I also have a User Object with some properties. Now when I run the program on my local machine, my user table seems to merge with the user table that websecurity tries to auto create for me when it makes all the membership tables. So I have no problem there, however when I try to deploy my site to azure website it doesn't work. websecurity makes it's own User table with Id, UserName, ect.., and it seems to rename my other user table to 'users' table with an 's'. Any idea why this is happening? Is it just me or do other people run into a lot of db deployment problems with azure? It never works, very frustrating; works fine or my local machine though. </p>
  
  <p>User Object: </p>
  
  <pre><code>[Table("User")]
  public class User : IAuditable, IIdentifiable
  {
      public User()
      {
          IsActive = true;
          IsDeleted = false;
          Friends = new List&lt;Friends&gt;();
          SharedFeeds = new List&lt;SharedFeed&gt;();
      }
  
      [Key]
      [DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)]
      public int UserId { get; set; }
  
  
      public string UserName { get; set; }
  
  
      public string Password { get; set; }
  
      [Required]
      public string FirstName { get; set; }
  
      [Required]
      public string LastName { get; set; }
  
      public string State { get; set; }
  
      public int ZIPCode { get; set; }
  
      public string UsersTheme { get; set; }
  
      public Boolean IsActive { get; set; }
  
      public Boolean IsDeleted { get; set; }
  
      public virtual List&lt;Friends&gt; Friends { get; set; }
  
      public virtual List&lt;SharedFeed&gt; SharedFeeds { get; set; }
  
  
  }
  </code></pre>
  
  <p>In my InitializeSimpleMembershipAttribute.cs: </p>
  
  <pre><code>[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
  public sealed class InitializeSimpleMembershipAttribute : ActionFilterAttribute
  {
      private static SimpleMembershipInitializer _initializer;
      private static object _initializerLock = new object();
      private static bool _isInitialized;
  
      public override void OnActionExecuting(ActionExecutingContext filterContext)
      {
          // Ensure ASP.NET Simple Membership is initialized only once per app start
          LazyInitializer.EnsureInitialized(ref _initializer, ref _isInitialized, ref _initializerLock);
      }
  
      private class SimpleMembershipInitializer
      {
          public SimpleMembershipInitializer()
          {
              Database.SetInitializer&lt;DataContext&gt;(null);
  
              try
              {
                  using (var context = new DataContext())
                  {
                      if (!context.Database.Exists())
                      {
                          // Create the SimpleMembership database without Entity Framework migration schema
                          ((IObjectContextAdapter)context).ObjectContext.CreateDatabase();
                      }
                  }
  
                  WebSecurity.InitializeDatabaseConnection("DefaultConnection", "User", "UserId", "UserName", autoCreateTables: true);
              }
              catch (Exception ex)
              {
                  throw new InvalidOperationException("The ASP.NET Simple Membership database could not be initialized. For more information, please see http://go.microsoft.com/fwlink/?LinkId=256588", ex);
              }
          }
      }
  </code></pre>
  
  <p>It seems as if this is giving me problems with azure:</p>
  
  <pre><code>   WebSecurity.InitializeDatabaseConnection("DefaultConnection", "User", "UserId", "UserName", autoCreateTables: true);
  </code></pre>
  
  <p>I need to use websecurity but also be able to add extra properties to the user</p>