This project has moved and is read-only. For the latest updates, please go here.

queries on Polymorphic table fails

Nov 12, 2012 at 12:00 PM

I have a table 'TableA' which represents TypeA and its child TypeB

A third table 'People' has a many to many relationship to TableA.

when I issue a query like

from p in _entities.People where p.Id = 7 from t in p.TablesUsingPeople select a;

I get an InvalidOperationException at line 76 in TransformVisitor.  This seems to happen with a variety of syntaxes expressing much the same query.

This morning has been spent polymorphising TableA.  Prior to that I had the same table structure and the query worked.

I've run a similar query against a SQL Server database with this structure and it seems to work OK.

Can you take a look?

Thanks

 

Iain

Nov 12, 2012 at 12:03 PM

(that line should have read)

from p in _entities.People where p.Id = 7 from t in p.TablesUsingPeople select t;

Nov 12, 2012 at 12:44 PM

"I get an InvalidOperationException at line 76 in TransformVisitor"

This doesn't say too much, could you share the whole (Effort related) stack trace?

ps: You can always edit your post :)

Nov 12, 2012 at 2:13 PM

I’ll try and sort you out a test project tonight.

I’m half-way through some updates right now.

Also, I need to sanitise the table names and so on so my client’s info isn’t revealed (not that you’d care, but…).

Thanks

Iain

From: tamasflamich [email removed]
Sent: 12 November 2012 12:44
To: iain@idcl.co.uk
Subject: Re: queries on Polymorphic table fails [effort:402840]

From: tamasflamich

"I get an InvalidOperationException at line 76 in TransformVisitor"

This doesn't say too much, could you share the whole (Effort related) stack trace?

ps: You can always edit your post :)

Nov 13, 2012 at 12:48 PM

Thank you! Although in this case a full stack trace that shows in which method the exception was thrown might be enough.

Nov 13, 2012 at 3:47 PM

I have a test project to send you, but don’t want to send it to the list.

Can you provide a ‘real’ email address for me and I will send it there.

Thanks

Iain

From: tamasflamich [email removed]
Sent: 13 November 2012 12:48
To: iain@idcl.co.uk
Subject: Re: queries on Polymorphic table fails [effort:402840]

From: tamasflamich

Thank you! Although in this case a full stack trace that shows in which method the exception was thrown might be enough.

Nov 13, 2012 at 5:09 PM

I have sent a private Codeplex message, did you get it?

Nov 15, 2012 at 11:57 PM

I figured out that the InvalidOperation exception was thrown by the Join transformation method. I have been already planning to rewrite it completely because of other reasons. At least this problem raises the priority.

Nov 19, 2012 at 1:46 PM

Hi, Tamas.

The issue above seems related to the inheritance aspects of EF (TPH).  I'm going to be using a lot of this in this project, so this is starting to become a problem.

I'm having to comment out an increasing number of unit tests!  My alternative is to run my unit tests against a real database, but there are a whole lot of reasons why I don't want to do this.

Do you any idea when you might be able to sort this out?  If I know, roughly, then I can decide what my best way forward is.

Thanks

 

Iain

Nov 19, 2012 at 2:03 PM
Edited Nov 19, 2012 at 2:07 PM

Check the recent changeset, I have rewritten the join tranformation method.

 

Nov 20, 2012 at 1:22 PM

Hi, Tamas.  That seems to have worked well.  Thank you!

Iain