Repository vs Service pattern in DAL: EF and Dapper

后端 未结 4 705
情深已故
情深已故 2021-02-01 09:18

I\'m working on project and I need to design the DAL. I will be using Entity Framework for most of the project and Dapper for some performance-sensitiv

4条回答
  •  粉色の甜心
    2021-02-01 09:42

    I can say that your issue is common enough and it has a common solution - CQRS (Command Query Responsibility Segregation). This pattern is widely used when people practice DDD (Domain Driven Design) in their projects and face difficulties with some performance-sensitive areas.

    There is no difference what ORM you will use. It is OK to have different components that retrieve data.

    You can use Repositories or/and Entity Framework and use all its features for most of the project to perform C-reate R-ead U-pdate D-elete operations.

    But for some performance-sensitive areas you can use Queries. They will return DTOs filled by Dapper (R-ead operations).

提交回复
热议问题