Entity Framework POCO objects

Posted by Dan on Stack Overflow See other posts from Stack Overflow or by Dan
Published on 2010-06-15T16:48:38Z Indexed on 2010/06/15 16:52 UTC
Read the original article Hit count: 239

Filed under:
|
|
|
|

I'm struggling with understanding Entity Framework and POCO objects. Here's what I'm trying to achieve.

1) Separate the DAL from the Business Layer by having my business layer use an interface to my DAL. Maybe use Unity to create my context.

2) Use Entity Framework inside my DAL.

I have a Domain model with objects that reside in my business layer. I also have a database full of tables that doesn't really represent my domain model. I setup Entity Framework and generated POCO objects by using the ADO.NET POCO Generator extension. This gave me an object for each table in my database. Now I want to be able to say context.GetAll<User>(); and have it return a list of my User objects. The User object is in my business layer. Is that possible?

Does that make sense or am I totally off and should start over? I'm guessing I need to use the repository pattern to achieve this, but I'm not sure.

Can anyone help?

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET