Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Execute a LINQPad query on opening it

Tags:

linqpad

Is there a way by which, when I open a query in LINQPad, it executes it and puts me in the result-only view? The intended use case for this is to write small applications within LINQPad. I don't want to hit F5 and Ctrl+Shift+R every time.

The motivation for this is the recently released RegEx utility in 5.36. This is also a script that does the same.

like image 717
Shrayas Avatar asked Jan 01 '23 03:01

Shrayas


1 Answers

I've added an Util.OpenQuery method to the next build:

public static Task<bool> OpenQuery (string queryPath, bool run = false,
                                    bool hideEditor = false, params object[] args)

You'll then be able to call this from the Automator query:

void Main (System.Windows.Forms.Keys key, string currentQueryPath)
{
    if (key == (Keys.Shift | Keys.Control | Keys.Alt | Keys.F1))
        Util.OpenQuery (@"my query.linq", true, true);
}

This will allow you to automate up to 12 queries (with hotkeys Alt+Shift+Ctrl+ [F1-F12])

like image 180
Joe Albahari Avatar answered Apr 06 '23 19:04

Joe Albahari