Joining two repos.GetAll() using where clause.
See original GitHub issueWe are using ABP to upgrade an old system which contains a lot of embedded SQL in code, and we want to translate the SQL text into C# query expression as much as possible.
The old SQL code used where clause to join tables, but ABP seems not support it…
We know we can use join ... on ... equals
in ABP, like this:
var records = from user in userRepo.GetAll()
join userRole in userRoleRepo.GetAll() on user.Id equals userRole.userId
...
But if we want to translate the SQL like this:
var records = from user in userRepo.GetAll()
from userRole in userRoleRepo.GetAll()
where user.Id == userRole.UserId
...
It throws LINQ to Entities does not recognize the method 'System.Linq.IQueryable``1[UserRole] GetAll()' method, and this method cannot be translated into a store expression.
So I can only use join ... on .. equals
to join tables in ABP?
Issue Analytics
- State:
- Created 6 years ago
- Comments:22 (11 by maintainers)
Top Results From Across the Web
SharpRepository - Join Between Two Repositories
1 Answer. There is a Join method on the repository that is similar to a LINQ Join statement and will let you join...
Read more >Repository Pattern and Joined Queries
Joins are for correlating data sets with multiple records. That's not what you have here. Do you have a more concrete, real-world example...
Read more >How to Use Multiple Inner Joins in SQL
To join two tables in SQL, you add the first table to the FROM clause, then add a join keyword (such as Inner...
Read more >4 Common Mistakes with the Repository Pattern
Nothing! Your repositories should return domain objects. So, the GetOrders() method should return an IEnumerable. With this, the second example ...
Read more >1. Working with Spring Data Repositories
The first configuration example will try to look up a class com.acme.repository.UserRepositoryImpl to act as custom repository implementation, where the second ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Let it be open. I added to it backlog to consider to convert GetAll to a property.
If this is a general problem and adding a property helps to overcome these problems, we may consider to add a property to IRepository which returns IQueryable.