Linqpad Automation Interface - What Are Your Thoughts? |
![]() ![]() |
Linqpad Automation Interface - What Are Your Thoughts? |
Mar 20 2009, 11:28 PM
Post
#1
|
|
|
Advanced Member ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 215 Joined: 15-February 08 From: Perth, Australia Member No.: 90 |
I'm thinking of adding an automation interface for LINQPad. This would mean you could reference LINQPad.exe from an external program and then automate the execution of queries like this:
CODE using LINQPad.Automation; static void Main() { var queryOutput = Query.Run ("myquery.linq"); if (queryOutput.Successful) File.WriteAllText ("results.html", queryOutput.Results); } Here's what the complete automation interface might look like: CODE namespace Automation { // All members threadsafe public class Query : IDisposable { // args would be for queries of type "C# Program" // or "VB Program" and would get passed to the Main method. public Query (string fileToOpen, params object[] optionalArgs) { } public ResultsFormat ResultsFormat { get; set; } public void Start () { } public void Start (bool waitUntilComplete) { } public bool IsExecuting { get; } public void Cancel () { } public WaitHandle WaitHandle { get; } public QueryOutput Output { get; } public void Dispose () { } // Helper method public static QueryOutput Run (string filePath) { using (var query = new Query (filePath)) { query.Start (true); return query.Output; } } } public enum ResultsFormat { // Default - identical to LINQPad's standard output Xhtml, // No fluff - ideal for regression testing Text, // This would be effective for queries that dumped // a single result set. CSV } public class QueryOutput { public readonly bool Successful; public readonly string Results; public readonly string SqlTranslation; public readonly string LambdaTranslation; public readonly string ILTranslation; } } Command-line support would build on this, although it would expose only a small subset of the features available via the automation interface. It would also be possible to automate LINQPad from within LINQPad itself - so you could run several queries in one go. What are people's thoughts? Joe |
|
|
|
Mar 23 2009, 06:46 AM
Post
#2
|
|
|
|
I think this sounds great. LINQPad has definately become my primary tool for doing almost anything. I almost feeling like I'm too addicted to it and becoming too much of a C# 'script junkie'...but I digress.
I also like the idea of LINQPad automating itself as well...it opens the possibilities of working on multiple databases from one 'master' script which I've needed a couple times. My only suggestions are for the 'results' (and I'm not sure of the effort or feasiiblity) 1) I think there should be a pure Xml result. 2) Any chance of getting a IEnumerable<object> or similar passed back? Both of these would be better suited if you needed to pass some information from script to script. Obviously with #2 we'd need to write an extension method or something, and speed wouldn't be great (thinking it'd need a bit of reflection), but that would be acceptable in the few situations where I'd like to pass info between scripts i.e. just getting some read only lists from one DB to another to compare and report on (if speed were issue, I'd just have to write a full blown c# app). Finally, a bit off topic, but not sure if some of the re-work/effort you need for automation would be good time to think about it...it'd be nice in the output window of LINQPad if we could disable HTML encoding. There are a few times when I query stuff and want to make HTML links that are simply clickable from output window to open a new browser and navigate to my target. Would be great to get this too Looking forward to the automation with or without my result suggestions, I've a few good uses for just plain old single script automation 'right now' |
|
|
|
Mar 24 2009, 04:36 AM
Post
#3
|
|
|
Advanced Member ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 215 Joined: 15-February 08 From: Perth, Australia Member No.: 90 |
These are good ideas. Piping results between queries as objects might be tricky, though - the data would have to be serializable for a start. I'll think on it more.
Thanks Joe |
|
|
|
Mar 26 2009, 06:39 AM
Post
#4
|
|
|
|
I think that automation would be very useful. I often call .NET code from other languages such as Mathematica. It would be a lot faster to set up C# code in LINQPad as opposed to Visual Studio.
|
|
|
|
May 4 2009, 02:03 AM
Post
#5
|
|
|
|
Hi Joe,
I was looking for a way to integrate LINQPad queries results as a quick reports generator, leveraging the html output, on my admin site. This Linqpad Automation Interface can really suit these needs. Hope it'll be released soon, Thanks, Shlomi |
|
|
|
May 6 2009, 12:33 PM
Post
#6
|
|
|
|
Please please please
|
|
|
|
May 14 2009, 01:34 AM
Post
#7
|
|
|
Advanced Member ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 215 Joined: 15-February 08 From: Perth, Australia Member No.: 90 |
You can now vote on this feature on UserVoice
Joe This post has been edited by JoeAlbahari: May 14 2009, 01:35 AM |
|
|
|
May 15 2009, 09:04 AM
Post
#8
|
|
|
|
Yes, please build the automation interface. Almost daily I think to myself "LinqPad really needs a Build button". It would be so nice to be able to hand an exe that does what my LinqPad script does over to less developer-minded people I work with. It seems with the automation interface that would be such a trivial task.
Thanks for the work you do on this! |
|
|
|
May 18 2009, 12:09 PM
Post
#9
|
|
|
|
Hi Joe,
Like frankkampas, I call .NET code and objects from other languages. In my case Dyalog APL. While manipulating the EDM graph of .NET objects and building text snippets for EntitySQL methods works well, C# scripting for LINQ not so well. Automation that allowed sending generated C# scripts for LINQ (or other snippets) to LINQPad and return of results such as collections, possibly through html piping would be wonderful! Ross |
|
|
|
May 26 2009, 08:40 AM
Post
#10
|
|
|
|
It would be really cool if .linq files were actually compiled exes which we could then call from the command line or reference in our .NET projects. The script content itself could be read from some metadata.
|
|
|
|
Jul 10 2009, 06:36 AM
Post
#11
|
|
|
|
Is there any news on this front?
|
|
|
|
Jul 15 2009, 05:43 AM
Post
#12
|
|
|
Advanced Member ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 215 Joined: 15-February 08 From: Perth, Australia Member No.: 90 |
Development on LINQPad has been quite slow lately - because I'm completing on C# 4.0 in a Nutshell. Most of the work on this will be finished soon - and they I'll start on the next LINQPad update. They'll almost certainly be something to support automation - whether it allows the compilation of standalone EXEs, I'm not sure though. I would have to see how easily I can remove the dependencies on LINQPad.
Cheers Joe |
|
|
|
![]() ![]() |
|
Lo-Fi Version | Time is now: 22nd November 2009 - 04:51 PM |