Joellao
EF Migrations 101
All my problems started with a ManyToMany relationship. User and Groups. I have UserEntityu and GroupsEntity. I also created a middle Entity to map this called UserGroupEntity. That seems quite simple. The first problem with this arose with having in the UserEntity a CreatedGroups and then a ParticipatingGroups collections.
I wanted also to avoid having the middle table relationship in the two entities. Finally I made it work with this piece of horror
Today I wanted to create a Friendship relationship, so a List of UserEntity in the UserEntity should make the trick. Nope, it doesn't work because the UserId is already in a relationship and can only be once (or something similar was the error, don't have it under my hands right now). So back to manually do the relationship by hand. Everything compiled, the database updated, but now there is a new column in the Users table that is not needed, and of course I don't have that mapping anywhere in the code and that's driving me crazy
27 replies