Use joins in Entity Framework with a DB context and a LINQ query.


Click “Next”, the following window will appear:


Select the required database objects as per your needs and click on the “Finish” button.

An edmx file will be added into the solution as per the image show under the following:


These are the very basic steps to create an entity object from an existing database as shown above. Now let’s proceed further and get to the core topic to use Joins with Entity Framework.

Now open the RegisterController class file and write my code in Action “Verify” also as shown in the following image:


You can see the code snippet in the above diagram states that we are using an inner join on two tables, Orders and OrderDetails, and return the result to the view (that is of type OrderModel having the following code snippet).


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s