What can I do with the LINQPad.Runtime? - linqpad

Just learning about LINQPad and I am trying to do understand what I can do with the LINQPad.Runtime NuGet package. Where can I find the docs for this? Also, is this package the right one for NET6?

If you reference this package from a Visual Studio project, you can call Util.ToHtmlString to format objects as HTML via the Dump pipeline. You can also call Util.Run to execute LINQPad scripts - this makes it easier to pass parameters to the script and receive return values than shelling out to lprun.
LINQPad.Runtime works all versions of .NET >= .NET Core 3.1.

Related

Accessing TFS database using Vbscript

I have been assigned the task of creating a web dashboard with information I retrieve from a TFS database using the available API. Ideally I would like to create this using Vbscript as I have existing code that could easily be reused, however I am unsure if there is away of connecting to the database using VBScript, any ideas if this is achievable??
I'll admit vbscript seems like a strange choice. That said, given the TFS API (the Object Model) is a .NET assembly then as long as you can call the methods properly from your VBScript code you should be OK.
As for calling .NET from VBScript have a look at this question: How do I call .NET code (C#/vb.net) from vbScript?

What is the best way to manage "non-SQL Server" SQL objects within Visual Studio 2010?

Visual Studio has a Database Project for Sql Server. This has a number of advantages: it hosts configuration settings, and database objects in one place. The .sql files are part of the regular .NET solutions - visible in the Solution Explorer and editable in Visual Studio. And they have a mechanism for generating a deployment script. With each individual database object in it's own file, the tracking of changes and source control is greatly simplified.
Has anyone had any success with using Database Projects with "non-SQL Server" databases? We use Sybase - which uses T-SQL and is very similar to SQL Server so I'm hopeful.
Or is there an alternative approach? I guess I could use a standard project (.csproj) and call a custom commandline application as part of the post-build to convert the .sql files into a deployment script.
Any ideas would be welcome.
Thanks
OK, I'll answer my own question.
I added all of our SQL objects to their own .sql files within a Visual Studio .dbproj project. However, minor syntactic incompatibilities between the Sybase version of RAISERROR and the Microsoft version of RAISERROR caused the validation code built into Visual Studio to get unhappy. The problem with the database project was that this actually caused a compilation error - which basically made it into a show-stopper.
So I scrapped that idea and added the .sql files to a standard .csproj project file. I then implemented some custom code that would load all of the .sql files, and aggregate them into a deployment script when invoked. I added a call to the custom code to the post build of the .csproj file so that whenever it was compiled - it would output a deployment script - which works like a dream with our build server.
In order to get some of the benefits of the .dbproj, I looked into writing a full SQL parser, but was quickly discouraged by some of the posts on SO. Instead I did some rudimmentary parsing with regex - which got me a few cool features without a lot of effort:
The code could detect dependencies between the various .sql files, and add them to the deployment script in the correct order to avoid sysdepends warnings.
Where there were no dependencies, objects were ordered based on the object type (stored procedure, function, grant statement, etc) and then by name so that the resulting script was always ordered the same - which is very important if you need to diff two versions of the script.
The deployment script can figure out some of the required permissions, so I don't need to keep track of all of the GRANT statements.
Stored procedures that are in the database but not in the script can be dropped automatically - so I don't need to keep track of what state each database is in - we just run the script and everything is in the correct state.
We have a few stored procedures that our automated tests call that shouldn't be deployed. The code can detect these and include them in a Debug build and exclude them in a Release build.
The custom code also generates a diff script that determines what changes the deployment script will make to a database and prints them out. This allows the person who is running the script to get an idea of what it will do. For example, the diff script might tell them that no changes will be made - so they don't need to run the deployment script at all - which is kind of handy if it saves them logging in at 3am to take a database offline and take backups etc.
So the end result is that all of my SQL objects are in separate files making them easy to work with in Visual Studio and manage under source control. For the first time since I started this job, I can look at the history in source control and tell what files have been changed (before this we had one enormous .sql file with absolutely everything in it).

Tool for rest webservice parameterized load test

I have a set of rest webservices in java, I need a tool that allows to load test them using parameters (i use windows operating system and Java or .net). I need to call 1 webservice 100 times simultaneously with different parameters.
This can be done just calling the method that is the core of the webservice, so basically I need to run a unit test many times concurrently with different parameters
Can you suggest any SIMPLE tool?
Thank you
SoapUI
Visual Studio has a load testing component. I would recommend recording a "unit test" using Fiddler2 and exporting as a Visual Studio webtest.
Visual studio will allow you to plug in parameter values from a spreadsheet, text file or database.
The downside is the Visual Studio 2010 Ultimate edition is required for this, which is not cheap.
Otherwise the old WCat may do the trick.
You could still record the exact details of the transaction using Fiddler and convert to tests using JMeter to do the load test bit.
Web Performance Load Tester. It is not specifically designed for web services, but works pretty well with them.
You can try the chrome extension "DHC Client" for testing web service. It provide a very good interface and you can also check it with test and image too. Here is link:-
https://chrome.google.com/webstore/detail/dhc-rest-client/aejoelaoggembcahagimdiliamlcdmfm?hl=en
It also store the variable value for the next time and you can also store the cases and value for future reference.

Why does my MVC application report the GetExecutingAssembly Name as App_web_xxxxx.dll?

I am updating our CruiseControl.NET continuous integration environment from using the old Visual Studio 2008 Web Deployment projects to Visual Studio 2010.
I do not want to use the Beta 2010 Web Deployment projects as I think I can make use of the updated Publishing/Packaging in 2010.
Currently I have managed to configure the CruiseControl script to call MSBuild twice. First to Build the solution in the Release configuration and then to Package the MVC project.
I then copy out the correct files from the Package from a hideous file path (which makes me suspect I am not doing this right but heh) and the Transformed web.configs to the Test server.
This is finally working but unlike when I used the 2008 Deployment Projects this code returns the ExecutingAssembly as App_web_xxxxx.dll and not Company.Product.Web.dll which is what I'm after.
Dim CurrentAssembly As Reflection.Assembly = System.Reflection.Assembly.GetExecutingAssembly
Dim version As String = CurrentAssembly.GetName.Version.ToString
I know GetName returns the a longer string than just the name but I'm debugging it to see what it contains. I understand that is is the compiled/cached dll but why isn't it the one in the MVC bin.
Cheers
I figured this out - basically when I was calling Assembly.GetExecutingAssembly inside the footer.ascx. This meant that the code was in a dynamically compiled dll for the footer.
What I wanted was the DLL for the MVC website. So I used an extension property on the controller that set ViewStates with the Assembly information.
In my case I will want to use this code again so the extension property is in a different Assemmly that I can include in various MVC projects. This meant I had to change the code to use Assembly.GetCallingAssembly but it now works exactly how I wanted.

DB Pro (data dude) and Wix3 SqlExtension

I'm attempting to use Wix to create a database during install. I have my database setup with the Db Pro Visual Studio SKU (Data Dude as it's sometimes referred). However, the output seems to be only consumable by sqlcmd.exe since it uses specific syntax in it (variable references like :setenv and $(FOO)).
I'm trying to use the wix sqlextension which apparently isn't using sqlcmd.exe (I haven't investigated what data access technology it's using just yet.
Does anyone know if there is a way to use the output of data dude natively in the wix sqlextension or alternately if there is something that will take the sqlcmd output and translate it into the runtime sql needed to execute against the sql server?
Please note that the ultimate goal is to fully integrate wix into our build system so I am looking for an automated approach.
If you have created the package using Visual Studio DBPro it is best to use VSDBCMD.exe for the DB deployment. The benefits of this is that the VSDBCMD.exe always figures out the differential of the destination to the source and creates a delta script which can be run from the same command line. You just need to provide /action:Deploy.
There is a blog post that covers calling the sqlcmd.exe utility from WiX 3 at http://neilsleightholm.blogspot.com/2008/08/executing-sqlcmd-from-wix.html