RFE: support 'mixin' scripts?
The plugins directory and My Extensions are great mechanisms to support adding code that will affect all queries, and they're awesome.
However, I keep running across the need to have a set of scripts (say, 10 to 20) that all need some shared functionality that I need to write (not something available from an existing NuGet package). However, putting this functionality into My Extensions could be problematic, either because it brings in additional dependencies that you don't want to introduce across all scripts (certain NuGet packages, for instance) or because you're just trying to keep your My Extensions from becoming any bigger than it already is.
Currently the closest I can get (AFAICT) is to create a new C# class library then F4 and reference the output dll from the script, then use it like any other assembly. That's not horrible, but it means having to switch to VS and building something there.
I can use Util to compile/run other scripts, but that only supports returning a single value instead of letting me 'mix in' additional functionality (let me use the methods defined in that script, for instance).
Since it seems like LINQPad is already doing partial classes (or similar) for the UserQuery class, it seemed like being able to 'mix in' other scripts (perhaps in the same F4 dialog as dll/nuget references exist now?) might be doable.
Probably more trouble than it's worth since there are definitely workarounds, but with v5 in the works, figured I might as well ask.
However, I keep running across the need to have a set of scripts (say, 10 to 20) that all need some shared functionality that I need to write (not something available from an existing NuGet package). However, putting this functionality into My Extensions could be problematic, either because it brings in additional dependencies that you don't want to introduce across all scripts (certain NuGet packages, for instance) or because you're just trying to keep your My Extensions from becoming any bigger than it already is.
Currently the closest I can get (AFAICT) is to create a new C# class library then F4 and reference the output dll from the script, then use it like any other assembly. That's not horrible, but it means having to switch to VS and building something there.
I can use Util to compile/run other scripts, but that only supports returning a single value instead of letting me 'mix in' additional functionality (let me use the methods defined in that script, for instance).
Since it seems like LINQPad is already doing partial classes (or similar) for the UserQuery class, it seemed like being able to 'mix in' other scripts (perhaps in the same F4 dialog as dll/nuget references exist now?) might be doable.
Probably more trouble than it's worth since there are definitely workarounds, but with v5 in the works, figured I might as well ask.
Comments
It certainly eliminates the problem of a cascading DLL dependency graph, which would occur if you could reference other compiled queries.
I'm still working on the first V5 release right now, but will certainly bear it in mind.
An example scenario I'm working on as I write this is multiple scripts that are working with some JSON and currently there's no nice way (that I know of) to put the POCO object definitions into a single place (other than compiling it into a dll they all reference or dumping them into My Extensions with everything else).
Thanks, Joe!
https://github.com/scriptcs/scriptcs/wiki/Writing-a-script#loading-referenced-scripts