I extended my identity ApplicationUser profile (class) with list of values (Group model class):
public class ApplicationUser : IdentityUser
{
public virtual ICollection<Group> group { get; set; }
...
}
As my Group class is defined in another project in the solution, I cannot add a reference to the ApplicationUser(s) from Web project in that class (circular referencial integrity problem). So, when I run update-database ef code-first migrations created the join table Groups to connect the ApplicationUser and the Group, which have two columns, a key from Group class and a ApplicationUser's id key.
I have some problems here. First, generated Groups table have only Group id as it's primary key, not both ids as it should be. Second, when I try to remove group from a user in my application or to delete a user, ef try to update (set null) ApplicationUser's id column in join Groups table, which I don't want. It need to delete the row.
How can I fix this problem?