ASP.NET MVC 4 Error "Exception was thrown as the target of the call"

I use composite keys below the mvc model class of the same. I made two columns in the MS SQL Server database with both PK, FK, but I get an error in the class InitializeSimpleMembershipAttributeas "An exception was thrown by the target", please help me get how to create it. This is my model class.

 [Table("webpages_UsersInRoles")]
    public partial class UsersInRoles
    {
        [Column(Order = 0)]
        public int RoleId { get; set; }
        public virtual NewRoles roles { get; set; }

        [Column(Order = 1)]
        public int UserId { get; set; }
        public virtual UserProfile UserProfiles { get; set; }      
    }
+1
source share
1 answer

Why are you doing this? you do not need to define this yourself. if you use AccountController, and if you use WebSecurity Role, this table is created for you in the SimpleMemberShipInitializer filter. and you just need to use the built-in functions provided to you by SimpleMembership.

, , - .

0

Source: https://habr.com/ru/post/1629517/


All Articles