Click here to Skip to main content
15,889,992 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello.
I have some trouble with add additional field in table, which Entity Framework created for me to solve many to many relationship.
Let's start from beggining.
I have 2 classes (models):
C#
public class Craft
    {
        public int  CraftID { get; set; }
        public string Name { get; set; }
    }
}

and
C#
public class User
{
    public int UserID { get; set; }
    public string UserName { get; set; }
    public string Email { get; set; }
    public string Password { get; set; }
}

I need to bind this two models with the following requirements:
1. Any user has all type of crafts.
2. For every craft user has it's own skills (example: for craft "Alchemy" user#1 has 12K Skills).
I've tried to resolve this problem using articles: Creating a Many To Many Mapping Using Code First[]. Entity framework created for me table "UserCraft" with "CraftID","UserID". But i need to add additional field "Skills" into "UserCraft". If I using DB first, i can create this table (UserCraft) by hand, create constraints, and add any additional field as much as I want. How I can do it with CodeFist?
Posted
Comments
[no name] 13-Nov-14 5:29am    
if those are just extra field then add and run migrations. Is that not working?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900