Entity Framework Object POCOs

I struggle with understanding Entity Framework objects and POCO objects. This is what I am trying to achieve.

1) Separate the DAL from the business layer using my business layer using the interface for my DAL. Perhaps use Unity to create my context.

2) Use the Entity Framework inside my DAL.

I have a domain model with objects that are in my business layer. I also have a database full of tables, which does not actually represent my domain model. I install the Entity Framework and generated POCO objects using the ADO.NET POCO Generator extension. This gave me an object for every table in my database. Now I want to say context.GetAll<User>();and return to it a list of User objects. The User object is in my business layer. Is it possible?

Does this make sense, or am I completely disconnected and should start all over again? I assume that I need to use the repository template to achieve this, but I'm not sure.

Can anyone help?

+3
source share

Source: https://habr.com/ru/post/1750155/


All Articles