Click here to Skip to main content
Rate this: bad
good
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.
 
Thanks
Posted 6-Dec-12 23:45pm
Rate this: bad
good
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...!!!
  Permalink  
Rate this: bad
good
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)
  Permalink  

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

  Print Answers RSS
0 Maciej Los 290
1 OriginalGriff 275
2 Sergey Alexandrovich Kryukov 195
3 BillWoodruff 140
4 ProgramFOX 140
0 OriginalGriff 6,524
1 Sergey Alexandrovich Kryukov 6,048
2 DamithSL 5,218
3 Manas Bhardwaj 4,657
4 Maciej Los 4,150


Advertise | Privacy | Mobile
Web04 | 2.8.1411022.1 | Last Updated 25 Dec 2012
Copyright © CodeProject, 1999-2014
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