如何在 LINQPad 中添加多个查询文件夹?
在LINQPad的左下角,有一个用于显示查询的区域。一个选项卡是“我的查询”,另一个选项卡是“示例”。我找不到一种像“我的查询”中那样添加多个文件夹的方法,就像“示例”选项卡中的文件夹一样。我尝试右键单击并检查所有菜单项。
我不确定是否可以更改 XML 设置以在“我的查询”中包含多个文件夹来组织我的代码。
如何在 LINQPad 中拥有多个查询文件夹?
In the lower left corner of LINQPad, there is an area for display queries. One tab is My Queries and another one for Samples. I could not find a way to add more than one folder like in My Queries, just like one in Samples tab. I tried right click and checked all the menu items.
I'm not sure if I can change XML settings to include more than one folders in My Queries to organize my codes.
How can I have multiple query folders in LINQPad?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我在此处添加的答案并没有解决“如何在 LINQPad 中拥有多个根级别文件夹”这一隐含问题。但是,我认为它为以下问题提供了一种解决方案:如何“在“我的查询”中包含多个文件夹[原文如此]来组织我的代码?”
技术 1 - 只需添加文件夹(可以说比技术 2 差)
您可以在“我的查询”文件夹下有多个子文件夹,并且它们都会显示。这增加了能够稍微组织查询的好处,缺点是您可能会包含比预期更多的文件和文件夹:
要添加文件夹,只需导航到文件资源管理器中的“我的查询”文件夹,然后添加一个新文件夹。刷新“我的查询”窗格将显示新文件夹。
技术 2 - 符号链接
通过使用符号链接,您可以获得与技术 1 类似的结果。这种方法的好处是您可以仅链接您想要的文件夹(例如包含脚本的文件夹),而保留其他所有内容:
请注意创建符号链接通常需要计算机的管理权限。
使用 Powershell 创建符号链接很容易:
两种技术之间的区别
为了解释两种技术之间的真正区别,我将进一步解释图片中的文件夹结构:
在技术 1 中,显示了整个存储库,因为事实上,整个存储库都保存在“我的查询”文件夹下。在技术 2 中,我的存储库完全存储在其他地方,但我在“我的查询”文件夹中添加了一个符号链接,该链接指向存储库本身中包含的查询。技术 2 允许我将存储库存储在更合适的位置,同时仍然可以方便地将脚本显示在 LINQPad 的“我的查询”窗格中。
其他阅读
互联网上发布了几篇博客文章,其中包含有关 LINQPad 的一些提示和技巧。 Dan Clarke 的这篇博文讲述了他如何创建符号链接来管理他的脚本(他还列出了一些其他技巧)。
The answer I am adding here does not resolve the implicit question of, "how does one have multiple root level folders in LINQPad." However, I think it provides a solution to the question of, how "to include more than one folders [sic] in My Queries to organize my codes?"
Technique 1 - Just add folders (arguably worse than Technique 2)
You can have multiple sub folders under the My Queries folder, and they will all show up. This adds the benefit of being able to organize your queries a bit, with the downside being the fact that you will probably include a lot more files and folders than you intend to:
To add folders, just navigate to your My Queries folder in File Explorer, and add a new folder. Refreshing your My Queries pane will the display the new folder.
Technique 2 - Symbolic Links
You can achieve a similar result as Technique 1 by using symbolic links. The benefit to this approach is that you can link just the folders that you want (e.g. folders that contain scripts), while leaving everything else alone:
Please note that creating symbolic links typically requires administrative privileges on a computer.
Creating symbolic links is easy with Powershell:
The difference between the two techniques
To explain what is really different between the two techniques, I'll explain the folder structure from the pictures a bit more:
In technique 1, an entire repository is shown due to the fact that the entire repository is kept under the My Queries folder. In technique 2, my repository is stored somewhere else entirely, but I have added a symbolic link in my My Queries folder that points to the queries contained within the repository itself. Technique 2 allows me to store my repositories in a more appropriate place, while still allowing for the convenience of having scripts show up in the My Queries pane of LINQPad.
Other reading
A couple of blog posts have been put out on the internet with some tips and tricks around LINQPad. This blog post from Dan Clarke talks about how he creates symbolic links to manage his scripts (he also lists some other tricks).
目前无法在“我的查询”中显示多个根文件夹。如果您愿意,请在 linqpad.uservoice.com 上添加建议,以便我们评估需求。
There's no way to display more than one root folder in 'My Queries' at present. If you like, add a suggestion at linqpad.uservoice.com so we can guage demand.
LinqPad 不会在树中显示空文件夹,因此如果您只创建了一个文件夹,您还需要添加一个查询以使其显示在树中。这已经让我绊倒了好几次了。
LinqPad does not show empty folders in the tree so if you only created a folder you will also need to add a query for this to show in the tree. This has been something that has tripped me a couple of times.