1

I'm Using Composite keys in below Model class of mvc and same thing.I did in MS SQL Server database having two columns with both are PK,FK but i am getting error in InitializeSimpleMembershipAttribute class like "Exception has been thrown by the target of an invocation" please help me to get how to create. 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; }      
    }
Dev
  • 98
  • 2
  • 11
  • 1
    "Exception has been thrown by the target of an invocation" means that an exception was thrown, caught, wrapped and rethrown. In short, it's not the real reason. If you get an exception helper window in Visual Studio, could you click 'Copy exception details to the clipboard' and look at what that copies to the clipboard? – Luke Woodward Aug 26 '13 at 08:06

1 Answers1

0

why you doing that? you dont need to define this yourself. if you use AccountController and if you use WebSecurity Role this table is created for you in SimpleMemberShipInitializer filter. and you just need to use the built in functionality provided for you with SimpleMembership provider.

in short, you dont need to define this table which IMO is the reason you having these problems.

DarthVader
  • 52,984
  • 76
  • 209
  • 300