i've been playing with dotconnect for Oracle for two days and have found strange things.
Here is my setup:
- one Sql 2005 Server Express with Northwind
- one Oracle XE with Northwind script adapted for Oracle
- One Linq To Sql model for sql 2005 made with VS and one for Oracle made with the Entity Developer
The two model are nearly identical.
If I run these linq queries:
Code: Select all
var resNorthwindSql = from p in contextNorthwindSql.Products
select new { p.Category.CategoryName, p.ProductName, p.Supplier.CompanyName,p.Supplier.ContactName };
Code: Select all
var resNorthwindOracle = from p in contextNorthwindOracle.Products
select new { p.Category.Categoryname, p.Productname, p.Supplier.Companyname, p.Supplier.Contactname };
I got two different generated sql statement:
Microsoft Linq
Code: Select all
SELECT [t1].[CategoryName], [t0].[ProductName], [t2].[CompanyName], [t2].[Contac
tName]
FROM [dbo].[Products] AS [t0]
LEFT OUTER JOIN [dbo].[Categories] AS [t1] ON [t1].[CategoryID] = [t0].[Category
ID]
LEFT OUTER JOIN [dbo].[Suppliers] AS [t2] ON [t2].[SupplierID] = [t0].[SupplierI
D]
-- Context: SqlProvider(Sql2005) Model: AttributedMetaModel Build: 3.5.30729.1
Code: Select all
SELECT t4.CATEGORYNAME AS "Categoryname", t1.PRODUCTNAME AS "Productname", t3.CO
MPANYNAME AS "Companyname", t2.CONTACTNAME AS "Contactname"
FROM TEST.PRODUCTS t1
INNER JOIN TEST.SUPPLIERS t2 ON t1.SUPPLIERID = t2.SUPPLIERID
INNER JOIN TEST.SUPPLIERS t3 ON t1.SUPPLIERID = t3.SUPPLIERID
INNER JOIN TEST.CATEGORIES t4 ON t1.CATEGORYID = t4.CATEGORYID
- first, left outer join vs inner join. As the two columns(supplierid and categoryid) are nullable, I was expecting left join, like microsoft linq does.
- second, there are as many inner join as referenced columns in the query: I take two fields from the supplier table and it makes two join on the supplier table, which is wrong.
Maybe I missed something, but could you have a look at this case?
best regards,
laurent