Click here to Skip to main content
11,789,512 members (57,412 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: MVC CodeFirst EF5.0
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.

Posted 6-Dec-12 22:45pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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...!!!
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

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)

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

  Print Answers RSS
0 OriginalGriff 954
1 Maciej Los 765
2 KrunalRohit 666
3 CPallini 606
4 Richard MacCutchan 420

Advertise | Privacy | Mobile
Web03 | 2.8.1509028.1 | Last Updated 25 Dec 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100