Otis wrote:
MarcoP wrote:
Otis wrote:
1) runtime build nr ?
2) what are 'UserProfile' and 'User_Address' ?
Sorry, I should have known better.
1) v2.0.50727
That's the .net version
right-click the ormsupportclasses dll in windows explorer -> properties -> version tab. Also please the linq provider dll version.
2) UserProfile is just our user table and User_Address is our table that allows users to have more than one address. So, it contains two foreign keys, userId and addressId
Yes, but you didn't use LinqMetaData.<entityname> so this is unclear to me
hehe...geesh its early!
Here you go:
Versions:
2.6.10.0421
2.6.10.0315 (LINQ)
Sorry about that, I just copied that from LinqPad. Here is my actual code:
var q = from o in MetaData.Order
join oi in MetaData.Order_Item on o.OrderID equals oi.OrderID
join i in MetaData.Item on oi.ItemID equals i.ItemID
join ua in MetaData.User_Address on o.UserID equals ua.UserID into tempUa
from address in tempUa.DefaultIfEmpty()
join up in MetaData.User_Phone on o.UserID equals up.UserID into tempUp
from phone in tempUp.DefaultIfEmpty()
where o.Active == true
where address.Active == true
where phone.Active == true
select new OrderDTO
{
OrderId = o.OrderID,
OrderDate = o.CreatedOn,
FirstName = o.UserProfile.FirstName,
LastName = o.UserProfile.LastName,
BannerId = o.UserProfile.UniqueID,
Address1 = address.Address.Address1,
Address2 = address.Address.Address2,
City = address.Address.City,
State = address.Address.StateCode,
ZipCode = address.Address.PostalCode,
PhoneNumber = phone.Phone.FullNumber,
ItemCode = i.UniqueID,
ItemDescription = i.ItemNm,
Quantity = oi.Quantity,
TotalPoints = oi.TotalPoints.GetValueOrDefault(),
Status = o.OrderStatus.OrderStatusNm
};