I've been working on bringing the WebSecurity membership tables into Entity Framework, but I run into an issue when my DB is autogenerated by EF while inserting roles. The reason is that EF builds the roles table with the columns reversed (Role ID/User ID vs User ID/Role ID).
Looking through the source of aspnetwebstack, I noticed an INSERT statement in AddUsersToRoles in SimpleRoleProvider:
int rows = db.Execute("INSERT INTO " + UsersInRoleTableName + " VALUES (" + userIds[uId] + "," + roleIds[rId] + "); ");
The column names are not specified explicitly, so if the column order is different than expected, this statement will fail. I would like to see someone patch this and review other INSERT statements for a similar issue.
Looking through the source of aspnetwebstack, I noticed an INSERT statement in AddUsersToRoles in SimpleRoleProvider:
int rows = db.Execute("INSERT INTO " + UsersInRoleTableName + " VALUES (" + userIds[uId] + "," + roleIds[rId] + "); ");
The column names are not specified explicitly, so if the column order is different than expected, this statement will fail. I would like to see someone patch this and review other INSERT statements for a similar issue.