Click here to Skip to main content
15,886,714 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am developing application which will be used by Students, Providers, Administrator, Agents, etc. I am creating a Users table in database where login information of each user of the system (Agents,Students,Providers etc) will be stored and their respective fields (like firstname, lastname, etc) will be saved in respective tables like Students, Providers, etc. I am keeping userId which is primary key from users table as foreign key in other tables for relations.

The database will get hit when Student, Provider, etc are registering for the system through registration form. User related data will get stored in Users table and other fields specific to that entity will get store in its respective table.

I am using Entity Framework Code First with fluent API. Please help me to create model classes for these tables. Also there is one Interests table where while registering Student can select multiple Interests from the available interest from dropdown which will get fill from Interests table. I want to store this as well in StudentsInterests table. Help me to create model class for this as well.

Thanks
Posted

Well you can go in following manner :

->First of all add and entity model (edmx) in your solution

->Add your tables into that edmx

->Give relationships to tables

->Now you can generate POCO classes by selecting option "Add Code Generation Item"

->Then you can Generate Database from your model


Hope this helps

Happy Coding...!!!
 
Share this answer
 
Hi use VS addin's either EF productivity tools or EF Power Tools, after this tool is being installed,make reverse engineering with help of this tools.(POCOs and DbContext will automatically be created)
 
Share this answer
 

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