views:

79

answers:

3

Hello,

I'd like to allow my users to design and linq queries even if they don't know linq.

So I am thinking about having "SQL management studio" like window with the list of tables, fields and relationships and let the user drag and drop.

I could write it myself but it looks difficult. Is there a better way?

Is there a solution somewhere I could use?

+6  A: 

LINQPad

Darin Dimitrov
+1: It might not be 100% what you are looking for, but I suspect that it is the current best offering.
Jeroen Huinink
I love LINQPad (and paid for autocompletion! :), but it doesn't have (that I can tell) a query generation feature like tom is asking for.
James Manning
A: 

You could use one of available "SQL visual designers". It's very easy to translate a simple SQL to LINQ then.

aloneguid
+1  A: 

I don't believe anyone's tried to tackle this (that I can find at the moment, at least) - it would need to be implemented with dynamic queries driven by the UI. Some links related to that:

On a side note, if you're letting the users drive the query generation, though, I'm not sure what LINQ is getting you off-hand?

IOW, one alternative might be to use one of the existing GUI interfaces for generating the sql query and use that. If you want to still be able to interact with the strongly-typed classes that your linq-to-sql or linq-to-entities context gives you, you can go with query -> sqlcommand -> sqldatareader -> db.Translate as both give you Translate methods for this kind of scenario.

James Manning
Dynamic linq looks really cool
tom greene