Dynamic Linq Queries

23 views
Skip to first unread message

James

unread,
Dec 13, 2010, 9:41:09 PM12/13/10
to DbLinq
I have a report builder in a Silverlight client, and was wondering if
anyone had an idea on how to use dynamic queries with DbLinq? I
searched other discussions, but I'm not sure that the context of any
involves what I'm asking.

-jw

James

unread,
Dec 13, 2010, 9:47:22 PM12/13/10
to DbLinq
Also, some of these tables are "options" tables, for drop downs, etc.,
and because there are a lot of them, I'm not exporting them to code,
thus for the dynamically returned results, how would I get the schema
of the returned results?

James

unread,
Dec 13, 2010, 11:15:40 PM12/13/10
to DbLinq
Ok, just found out about "DataContext.Connection.CreateCommand()" in
one of the examples, is this the best way to approach this? I assume
the only caveat is that I have to match the SQL to the provider/vendor
type (obviously), since Linq helps to abstract it...?

TGB

unread,
Dec 14, 2010, 12:57:02 AM12/14/10
to dbl...@googlegroups.com
Better to use odbc connection


--
You received this message because you are subscribed to the Google Groups "DbLinq" group.
To post to this group, send email to dbl...@googlegroups.com.
To unsubscribe from this group, send email to dblinq+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/dblinq?hl=en.




--
TGB

James

unread,
Dec 14, 2010, 1:20:35 AM12/14/10
to DbLinq
Trying to avoid the use of ODBC. I use Linq mostly, but there are some
cases where I need a more dynamic result. Is it possible to create an
object of type "DynamicObject", pass it into
"ExecuteQuery<TResult>()", and create the data members "on the fly" as
they are queried (as "TryGetMember" is called)?

James

unread,
Dec 14, 2010, 7:31:34 PM12/14/10
to DbLinq
Ok, so I guess the only way to do use DbLinq and allow dynamic queries
at the same time requires:
1. Using "base.Connection.CreateCommand()" to get a command object to
perform a text query, then iterate over the results and copy into my
custom dynamic tables - keeping in mind this is a db-specific query
language.
2. Create a framework to convert my own "primitively supported SQL
language" into that understood by the different vendors for use with
#1 (I have my own wrapper for each vendor).

Some things I did also was to unseal the Table<> class (for my own
type-specific sub-classes [I have a good reason]), create a new
GetTable<>() method that accepts my custom generic type (i.e.
SpecialTable<Product>), recompile the source, and voila!, then DbLinq
is none the wiser. ;)

-jw
Reply all
Reply to author
Forward
0 new messages