I have 2 tables with the following structure:
User
UserId | Age
----------------
1 15
2 36
3 25
DictAges
Title | FromAge | ToAge
-------------------------------
1 0 20
2 20 35
3 35 100
I created the neccessary models for the DbContext, called UserModel
and DictAgesModel
with the exact same properties shown at the table structure. I would like to query a user with its id, and join title based on the user's age. Here's the MySQL code I used before:
SELECT User.UserId, DictAges.Title
FROM User, DictAges
WHERE User.UserId = :id
AND User.Age BETWEEN DictAges.FromAge AND DictAges.ToAge
Note, that I don't have any navigation property added to any of those models (should I add any??)
How could I translate a query like this to entity framework core query?