Open GoogleCodeExporter opened 9 years ago
I think i have the same issue but with SQLite,
Tables :
LineNodes: has Id, LineId, and NodeId, foreign keyed to Line and Node tables
Execute the following query:
var lineQuery = from lineNode in db.LineNodes
select lineNode.Line;
Generates:
SELECT "Id", "Name", "OneWay", "TypeId"
FROM "main"."Line"
WHERE ("Id" = lineNode$."LineId")
which throws an exception (it's not joining on the LineNode table)
Original comment by ofer.ach...@gmail.com
on 12 Jun 2010 at 6:04
The following patch appears to fix the issue:
Index:
src/DbLinq/Data/Linq/Sugar/Implementation/ExpressionDispatcher.Analyzer.cs
===================================================================
---
src/DbLinq/Data/Linq/Sugar/Implementation/ExpressionDispatcher.Analyzer.cs (revi
sion 1410)
+++
src/DbLinq/Data/Linq/Sugar/Implementation/ExpressionDispatcher.Analyzer.cs (work
ing copy)
@@ -668,11 +668,11 @@
string.Format("Explicit construction of entity type '{0}' in query is not allowed.",
ex.Type.FullName));
TableExpression tableExpression = parameters[0] as TableExpression;
- if (tableExpression != null &&
builderContext.CurrentSelect.Tables.Count == 0)
- RegisterTable(tableExpression, builderContext);
+ if (tableExpression != null && (builderContext.CurrentSelect.Tables.Count
== 0 || tableExpression.JoinType == TableJoinType.Inner))
+ RegisterTable(tableExpression, builderContext);
return ex;
}
-
+
/// <summary>
/// Entry point for a Where()
/// static Where(this Expression table, λ(table))
Original comment by ofer.ach...@gmail.com
on 4 Jul 2010 at 5:08
Original issue reported on code.google.com by
Bon...@gmail.com
on 5 May 2010 at 10:41