Home  /  Questions  /  Question

108   96.7
Mar 29, 2012

Entity Framework Mapping

How do you map with the entity framework when there is more than 1 table? In the example they only map to 1 table. But what happens when you have to pull data from 2 or more tables and need to map the data? For example they are just passing a CategoryEntity which is just a table on in the .dmx file and mapping it to their business object class. what if you have multiple tables what do you pass?


588   99.9
Apr 15, 2012

I'm not sure I understand your question, but in the .edmx file, you can add as many database tables, which turn into Entity Framework entities, as you want.  Then you can reference them all.

If you are talking about related tables (entities) to a table, the Entity Framework makes those relationships automatically.  When you reference an entity set and it has a relationship with other entities, there will be access to those relationships off of that entity.

Does that answer your question?


King Wilder
 1 comment
Hi, I am not sure if it is completely related to it, but how do you manage entities in case of many to many relationships. I am using dbContext and it doesn't generate Entities for Many to Many joins tables., In you Condor generated code, how do you manage to load related data for many to many entities, I noticed that Condor generates Dao and Business objects for these Entities in this case, but it doesn't Add Properties for such related Entities in business generated Business Object classes. --- Javed Hussain  Jun 20, 2012