user745607
user745607

Reputation: 717

entityframework inner join

I am trying to join between customers,orders,orderdetails and products

I used the following to generate an inner join query

IQueryable<Customer> CustomerList = ent.Customer
                                     .Include("orders").Include("orders.orderdetails")
                                      .include(orders.orderdetails.products)    

I need to generate an inner join with these tables so that i can check surname and firstname in where clause but it is generating left outer join.

How to generate an inner join with these tables

thanks

Upvotes: 0

Views: 1024

Answers (2)

JTorrecilla
JTorrecilla

Reputation: 208

var query = from OrdersDetails od in ent.OrdersDetails
            select new {
                od.Orders.Customers.FirtsName,
                od.Orders.OrderDate,
                ....
            }

Hope it helps.

Upvotes: 2

Jatin Trikha
Jatin Trikha

Reputation: 71

try this

            var v = from en in context.Entity
                let leftouter = (from pa in en.PostalAddress
                                 select new
                                 {
                                     pa.PostalAddressID
                                 }).FirstOrDefault()
                select new
                {
                    EntityID = en.EntityID,
                    PostalAddressID = (Guid?)leftouter.PostalAddressID,
                };

refered from http://geekswithblogs.net/SudheersBlog/archive/2009/06/11/132758.aspx

Upvotes: 0

Related Questions