Otis wrote:
I think you're connecting to the wrong server with your connection string somehow.
Nope.
It was me-- the schmuck.
:-)
Here's what happened...
I got a HelperClasses.EntityCollection object and an IEntityFactory2 object.
I built a complex PredicateExpression and a RelationPredicateBucket.
I ran it and got back a collection of ObjectTypeA.
I built a new complex PredicateExpression and a RelationPredicateBucket, based on ObjectTypeB.
But, I did NOT (unfortunately) reset the EntityCollection or the EntityFactory to be ObjectTypeB.
Well, when I ran the new PredicateExpression to fetch the collection, OOPs... cannot query ObjectTypeB with a where clause based on ObjectTypeA.
Ug.
As usual-- the error is between the seat and the keyboard.
However...
I did discover this LLBLGen hidden (for me) gem...
...I caught the exception and in the Immediate Window I typed this...
?DirectCast(ex, ORMQueryExecutionException).QueryExecuted.ToString()
...and it gave me this...
SELECT
[RulesEngine].[dbo].[BrePropertyInfo].[Id],
[RulesEngine].[dbo].[BrePropertyInfo].[BreDatatypeCodeId],
[RulesEngine].[dbo].[BrePropertyInfo].[BreTypeInfoId],
[RulesEngine].[dbo].[BrePropertyInfo].[CanRead],
[RulesEngine].[dbo].[BrePropertyInfo].[CanWrite],
[RulesEngine].[dbo].[BrePropertyInfo].[Name]
FROM
[RulesEngine].[dbo].[BrePropertyInfo]
WHERE
( ( [RulesEngine].[dbo].[BreDatatypeCode].[Value] = @Value))
...which explained things to my thick head...
...that is, basically-- you cannot include columns in the WHERE clause that are not part of some SELECT... Doh!!!!
Anyway, finding out about...
?DirectCast(ex, ORMQueryExecutionException).QueryExecuted.ToString()
...made the whole thing worth it.
(I'm losing my hair anyway-- who cares if I pull some of it out myself.)
(BTW, the happy-ending is that that was the only thing keeping the code from running. It looks OK in terms of output, so that is good. But, this silly coding error has me rethinking my code. Time for some Divide-And-Conquer refactoring.)
Thank you.
--Mark Kamoski