Monsters Weekly 194 - Single File Applications in .NET 5

In today’s episode, we take a look at publishing self-contained single file executables in .NET 5. Publishing applications in this way allows us to easily deploy our .NET 5 applications to devices that don’t have the .NET runtime installed. We can even build executables for Linux from our Windows development machine.

Links:
https://docs.microsoft.com/en-us/dotnet/core/deploying/single-file
https://docs.microsoft.com/en-us/dotnet/core/rid-catalog

Monsters Weekly 193 - Background Tasks Hangfire 101

Break your work down into smaller pieces that can be completed in the background, even if your user walks away from the page. In this episode we’re giving an into to Hangfire, a mature open source library that allows you to process background tasks in a fire-and-forget manner in any environment, local, server or cloud.

Project: https://www.hangfire.io/
Install: https://www.nuget.org/packages/Hangfire/
Repo: https://github.com/HangfireIO

Processing Google reCaptcha Tokens in ASP.NET Core

Integrating a simple test to help prevent malignant input on your site is as simple as integrating a few lines of code into your website.

Now, if I could I’d pinch myself to make sure I’m not a robot, but I know very well that if I’m smart enough to think of that, they must have also programmed a sense of touch and pain into me as well. So testing to see if a website user is going to be even more daunting, because we can’t even pinch them.

Thankfully, the reCaptcha service offered by Google is free add-on to your site that will help to avoid bad data getting into your site, prevent malicious users from gaining access to your resources, and helping you to avoid unwanted side effects of bots that pile up junk data through your forms.

Read on to see how to get this all wired up in a Razor Pages application in ASP.NET Core. Heck, if you are in an MVC app or are building a Web API (or Azure Function) this would all still serve useful!

Monsters Weekly 192 - C# 9 Top Level Statements

C# brings with it a bunch of new features. Top level statements or programs make it easier to get started in C# if you haven’t written a program in it before. They can also make developing small applications faster.

Allocating a Serverless Database in SQL Azure

I’m pretty big on the SQL Azure Serverless SKU. It allows you to scale databases up and down automatically within a band of between 0.75 and 40 vCores on Gen5 hardware. It also supports auto-pausing which can shut down the entire database during periods of inactivity. I’m provisioning a bunch of databases for a client and we’re not sure what performance tier is going to be needed. Eventually we may move to an elastic pool but initially we wanted to allocate the databases in a serverless configuration so we can ascertain a performance envelope. We wanted to allocate the resources in a terraform template but had a little trouble figuring it out.

Monsters Weekly 191 - C# 9 Pattern Matching

C# 9 brings pattern matching to a fantastic place allowing you to express complex patterns cleanly. In this episode we’ll play with some of the patterns you can use to make your code cleaner and leaner.

Running Stored Procedures Across Databases in Azure

In a previous article I talked about how to run queries across database instances on Azure using ElasticQuery. One of the limitations I talked about was the in ability to update data in the source database. Well that isn’t entirely accurate. You can do it if you make use of stored procedures.

Monsters Weekly 190 - Using Elastic Query on SQL Azure

SQL Azure doesn’t let you run queries between database instances. But if you’re migrating off on premise databases where you’ve been able to do that you probably don’t want to rewrite a bunch of code. Turns out there is a way around that using SQL Azure Elastic Query.

Links
Documentation - https://docs.microsoft.com/en-us/azure/azure-sql/database/elastic-query-overview

Azure Processor Limits

Originally posted to: https://blog.simontimms.com/2020/11/05/2020-11-05-processor-limits/

Ran into a fun little quirk in Azure today. We wanted to allocate a pretty beefy machine, an M32ms. Problem was that for the region we were looking at it wasn’t showing up on our list of VM sizes. We checked and there were certainly VMs of that size available in the region we just couldn’t see them. So we ran the command

az vm list-usage --location "westus" --output table

And that returned a bunch of information about the quota limits we had in place. Sure enough in there we had

Name                               Current Value   Limit
Standard MS Family vCPUs 0 0

We opened a support request to increase the quota on that CPU. We also had a weirdly low limit on CPUs in the region

Total Regional vCPUs               0               10

Which support fixed for us too and we were then able to create the VM we were looking for.

Querying Across Databases In SQL Azure

I seem to be picking up a few projects lately which require migrating data up to Azure SQL from an on premise database. One of the things that people tend to do when they have on premise databases is query across databases or link servers together. It is a really tempting prospect to be able to query the orders database from the customers database. There are, of course, numerous problems with taking this approach not the least of which is making it very difficult to change database schema. We have all heard that it is madness to integrate applications at the database level and that’s one of the reasons.