0

Is it possible to have a single POCO class that is made up of multiple store entities. For example my database has 4 related tables Tabe1, Table2, Table3, and Table4.

I want a single POCO class to represent some columns in the above tables. So the POCO class will be meaningful representation of these four tables. Only some columns will be represented not all.

I don't need any updates or delete operations. I want to build a reporting solution. I am using POCO because I want to use the same poco for other data sources.

So it possible to have a single POCO class that represents data from multiple database tables?

I'd really appreciate your help and thanks in advance.

Nasir
  • 59
  • 11
  • On the flip side, how would you go about saving this object back into each of the four tables if it's built up from small chunks of each table? – Chris Nov 20 '11 at 03:18
  • Thanks @Chris, I don't need to store data back to the database tables. This is explicitly for reading purposes. I don't need any Updates, delete, create operations. I am only intereseted in selecting from multiple tables as you would select using joins from multiple using classic sql. – Nasir Nov 20 '11 at 12:57

1 Answers1

0

The following link provides some good how-to for these common scenarios.

[EDIT - provided a better link for your POCO scenario]

mapping multiple tables to a single entity class in entity framework

Community
  • 1
  • 1
kingdango
  • 3,979
  • 2
  • 26
  • 43