Sql Pass through fails

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
edstaffin
Posts: 43
Joined: Mon 13 Oct 2008 13:23

Sql Pass through fails

Post by edstaffin » Tue 22 Nov 2011 18:53

Hi I have a simple pass through query that I am trying to use and it's giving me fits.

Dim qry As IEnumerable(Of V_REPORTING) = db.ExecuteQuery(Of V_REPORTING)(select f1, f2, f3 from V_Reporting)

I've dropped V_Reporting onto my lqml. It has a 5 fields.
For purposes of this discussion we'll just call them f1-f5.

If I query the db as shown above, I get an error that it can't find f4 and f5.
If I query all the fields it works fine.
This works correctly when I use regular LinqToSql with SqlServer.

Is there some magic sauce I am missing?

Because the field list is built at run time, I don't know ahead of time what the result set will look like.

Any help would be greatly appreciated!
Thanks ... Ed

StanislavK
Devart Team
Posts: 1710
Joined: Thu 03 Dec 2009 10:48

Post by StanislavK » Thu 24 Nov 2011 16:50

It is not allowed to use incomplete column sets in the selects executed via the generic ExecuteQuery method. The reason is that the entities loaded in this way are inconsistent and do not correspond to the data actually available in the database. This may lead to different problems related, e.g., to updating such entities (if update checks are enabled, they may fail for the empty columns) and executing further queries (as entities loaded via ExecuteQuery are cached, simple queries like 'db.V_REPORTINGs.ToList()' would return the same 'incomplete' objects).

However, we will consider returning non-cached and non-tracked objects for such 'incomplete' queries (like this is done for entities having no primary key). We will post here about the results.

edstaffin
Posts: 43
Joined: Mon 13 Oct 2008 13:23

Please do!

Post by edstaffin » Mon 28 Nov 2011 13:36

Hi,
Yes, please let me know when this is available. I use the pass through for a customized report generator and I never know ahead of time which columns the users might be interested in. I have hacked a work around by selecting all columns, then converting to a datatable and removing the columns I don't want. It's a hack, but it works for now.

Post Reply