2021年3月17日星期三

EF Core: How to load data from a table and related tables in Generic Repository

I created a Generic Repository that can help me in my projects.

The problem:

In these days I work on a project and I want to get data from some related tables (all data from one table and also load all related data from other tables that I select), the repository I was created can't handle this also I don't want to work directly with Entity Framework Core.

My repository:

My repository is an open source project, you can see the source code from here.

What I want exactly:

My idea is to create a method in my generic repository, this method will receive the entity that I want to select data from, and receive an expression that told it to load data from the scent entity and some related tables (not all related table but some related table that I will send in the expression).

How can I resolve this?

https://stackoverflow.com/questions/66680043/ef-core-how-to-load-data-from-a-table-and-related-tables-in-generic-repository March 18, 2021 at 03:35AM

没有评论:

发表评论