Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8914903
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T04:50:46+00:00 2026-06-15T04:50:46+00:00

I am using ASP.NET MVC 4 together with SimpleMemmbership. When I built my application

  • 0

I am using ASP.NET MVC 4 together with SimpleMemmbership.

When I built my application the following tables were built automatically

webpages_Membership

webpages_OAuthMembership

webpages_Roles

I can successfully register users.

However, the webpages_UsersInRoles table seems to be missing.

Does anyone know why this table is missing?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T04:50:48+00:00Added an answer on June 15, 2026 at 4:50 am

    This article might assist you in resolving your issue.

    Update:

    The article above got us going in the right direction. Our solution was to add a definition for “webpages_UsersInRoles to our UserProfile.cs class that gets used during initialization (we are doing code first).

       [Table("UserProfile")]
    public  class UserProfile
    {
        [Key]
        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        public int UserId { get; set; }
        public string UserName { get; set; }
        public string FirstName { get; set; }
        public string LastName { get; set; }
        [DataType(DataType.EmailAddress)]
        public string EmailAddress { get; set; }
        public bool IsEnabled { get; set; }
    }
    
    
    
    [Table("webpages_Membership")]
    public class Membership
    {
        public Membership()
        {
            //Roles = new List<Role>();
            OAuthMemberships = new List<OAuthMembership>();
            UsersInRoles = new List<UsersInRole>();
        }
    
        [Key, DatabaseGenerated(DatabaseGeneratedOption.None)]
        public int UserId { get; set; }
        public DateTime? CreateDate { get; set; }
        [StringLength(128)]
        public string ConfirmationToken { get; set; }
        public bool? IsConfirmed { get; set; }
        public DateTime? LastPasswordFailureDate { get; set; }
        public int PasswordFailuresSinceLastSuccess { get; set; }
        [Required, StringLength(128)]
        public string Password { get; set; }
        public DateTime? PasswordChangedDate { get; set; }
        [Required, StringLength(128)]
        public string PasswordSalt { get; set; }
        [StringLength(128)]
        public string PasswordVerificationToken { get; set; }
        public DateTime? PasswordVerificationTokenExpirationDate { get; set; }
        //public ICollection<Role> Roles { get; set; }
    
        [ForeignKey("UserId")]
        public ICollection<OAuthMembership> OAuthMemberships { get; set; }
    
        [ForeignKey("UserId")]
        public ICollection<UsersInRole> UsersInRoles { get; set; }
    }
    
    [Table("webpages_OAuthMembership")]
    public class OAuthMembership
    {
        [Key, Column(Order = 0), StringLength(30)]
        public string Provider { get; set; }
    
        [Key, Column(Order = 1), StringLength(100)]
        public string ProviderUserId { get; set; }
    
        public int UserId { get; set; }
    
        [Column("UserId"), InverseProperty("OAuthMemberships")]
        public Membership User { get; set; }
    }
    
    [Table("webpages_UsersInRoles")]
    public class UsersInRole
    {
        [Key, Column(Order = 0)]
        public int RoleId { get; set; }
    
        [Key, Column(Order = 1)]
        public int UserId { get; set; }
    
        [Column("RoleId"), InverseProperty("UsersInRoles")]
        public Role Roles { get; set; }
    
        [Column("UserId"), InverseProperty("UsersInRoles")]
        public Membership Members { get; set; }
    
    
    
    }
    
    [Table("webpages_Roles")]
    public class Role
    {
        public Role()
        {
            UsersInRoles = new List<UsersInRole>();
        }
    
        [Key]
        public int RoleId { get; set; }
        [StringLength(256)]
        public string RoleName { get; set; }
    
        //public ICollection<Membership> Members { get; set; }
    
        [ForeignKey("RoleId")]
        public ICollection<UsersInRole> UsersInRoles { get; set; }
    }
    

    Then on the class that inherits dbContext we added the public DbSet UsersInRoles { get; set; }.

      public class IntranetEntities : DbContext
    {
    
        public DbSet<UserProfile> UserProfiles { get; set; }
        public DbSet<Membership> Memberships { get; set; }
        public DbSet<Role> Roles { get; set; }
        public DbSet<UsersInRole> UsersInRoles { get; set; }
    
        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();
        }
    
        public override int SaveChanges()
        {
    
            try
            {
                return base.SaveChanges();
            }
            catch (DbEntityValidationException dbEx)
            {
                foreach (var validationErrors in dbEx.EntityValidationErrors)
                {
                    foreach (var validationError in validationErrors.ValidationErrors)
                    {
                        Trace.TraceInformation("Property: {0} Error: {1}", validationError.PropertyName, validationError.ErrorMessage);
                    }
                }
            }
            return 0;
    
        }
    }
    

    We then proceeded to build our project and using the VS package manager console we executed (since we are doing code first development)

    update-database -verbose

    webpages_UsersInRoles

    The model was then updated to our expectations. I have provided all the required code in the hopes it saves someone in the future time and grief.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am attempting to use ASP.NET MVC 4 beta together with JSON.NET. I'm using
I'm building an application using ASP.net MVC 3 and I'm wondering if anyone knows
Are there any open source projects using both asp.net mvc and silverlight together?
I've been doing some research on using ASP.NET MVC and Entity Framework together for
Does anyone have any experience of using SproutCore together with ASP.NET MVC? For what
I am using ASP.NET MVC 3 with the Razor engine together with the newest
I have an ASP.Net MVC application and I am using StructureMap within MVC to
me using asp.net mvc as technology behind. how can i use JavaScript for saving
Using ASP.Net MVC on my Site.Master I have: <head runat=server> <title><asp:ContentPlaceHolder ID=TitleContent runat=server />
Using ASP.NET MVC when trying to get the information stored on my Session[objectName] from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.