SQL Server database backup to Azure Blob Storage
SQL Server supports exporting data-tier applications (BACPAC). It means that database is packaged to one file with schema and data. It’s not same as SQL Server backups but to backup smaller databases it works pretty well. Those who don’t want to mess with local backup storage can use cloud services like Azure Blob Storage to keep database backups. Here’s the example how I automated backup of one not so big database using free tools SqlPackage and AzCopy.
Cost of exceptions
Hopefully the era of leprosy and corona is over for this time and it’s time to get back to blogging. Exceptions are powerful feature of object-oriented languages as far as they are used like they are thought to use – throw exception only when something really unexpected happens. This advice should be taken seriously – here’s why.
Adding claims to existing identity
During moving one system from classic ASP.NET MVC to ASP.NET Core I faced an interesting challenge. Although access to system is based on Active Directory there is separate role management based on classic membership and roles providers. There are reasons why AD is not used for role management and I cannot change it. ASP.NET Core uses claims-based authentication and I needed to find a way to add role claims to authenticated identity. Here’s the solution.
Running ASP.NET Core 5 RC applications on Azure App Service
Although .NET 5 is officially in RC and not yet officially supported on Azure cloud we can still deploy ASP.NET Core web applications built for .NET 5 to Azure App Services. I made my first ASP.NET Core 5.0 deployment to Azure App Service last week. There has been no problems on Azure side and my application is running very stable. Here’s how I did it.
Hosting applications on Azure B-series virtual machines
My fellow MVP Jiří Činčura wrote a nice blog post about hosting ASP.NET Core applications on Azure B-series small virtual machines: Running ASP.NET Core app on Azure B1ls VM (penny pinching). It’s the cheapest option on Azure for small applications. In this blog post I give you some additional advice about smallest B1-series virtual machines so you can build up a little safety net for your applications to make sure they don’t run out from resources.
Developing software on Surface Go 2
My previous post about Surface Go 2 was brief introduction based on my own experiences after one month of using it. Surface Go 2 is lightweight machine with limited hardware resources. It’s not your next portable dev machine as it’s more to the tablets world but still there are some software development options to consider before buying Surface Go 2. Here’s my advice.
Accessing restricted blob storage from virtual networks and Azure CDN
I decided to isolate Azure storage account behind this blog due to growing number of attacks against this little nice reading corner. I have anyway Azure CDN service enabled and it is perfect tool to get all static content of this blog as close to my dear readers as possible. Azure storage can be expensive and this is why I don’t want unbuffered traffic to land there, specially if it is generated by bunch of bots that doesn’t commit to glory of this blog anyhow. Here’s how to restrict public access to Azure storage account but keeping blob storage open…
Top-level programs in C# 9.0
C# 9.0 comes with nice new feature called top-level programs. It’s something that teachers of beginner classes will love for sure. Imagine – you start teaching C# with only two lines of code on screen. All missing code is generated by compiler. This blog post introduces top-level programs and shows some secrets of new C# compiler.
Translating NHibernate LINQ query to SQL
When working with stateless sessions in NHibernate we need some way to see generated SQL but we cannot use simple tricks as custom NHibernate interceptor to log SQL queries. As I’m using mostly NHibernate LINQ these days I was interested in how to get SQL out from LINQ query without actually executing it. Here’s my solution.
How to log NHibernate SQL to ASP.NET Core loggers
Logging SQL created by NHibernate ORM is useful when debugging new features of application. SQL logging in NHibernate is a little bit tricky and not so straightforward as it is with Entity Framework Core. This blog post demonstrates how to write SQL created by NHibernate to ASP.NET Core loggers using NHibernate interceptor.
Using Structuremap in legacy ASP.NET MVC applications
Dependency Injection (DI) was also supported by classic ASP.NET MVC but there was no framework-level dependency injection like in ASP.NET Core. In this blog post I will show how to use Structuremap for dependency injection in ASP.NET MVC applications and how to resolve dependencies using built-in components in classes that doesn’t support dependency injection.
Building ASP.NET Core applications on Visual Studio Codespaces and Visual Studio Code
On the search for running development environments on cloud I stumbled upon service calles Visual Studio Codespaces. It’s nice service that moves development and debugging workloads to cloud and it makes it possible to use lightweight machines like tablets and hybrids for development. Here’s my overview of how to build ASP.NET Core web applications on codespaces and Visual Studio Code.
Surface Go 2 review
Recently I bought Surface Go 2 tablet with Intel M3 CPU and LTE. Surface Go 2 is hybrid device being either tablet or small laptop. It is lightweight and therefore not the option for resource demanding workloads. Consider it more as an complementary device that is hyper-portable and supports you well if you are moving around. But Surface Go 2 is not yet another tablet – it’s more. Different from competiting offers it is not running limited or mobile edition of operating system but full Windows 10. I found Surface Go 2 to be killer device supporting my daily activities…
Introducing Azure Static Web App service
During Build 2020 Microsoft announced preview of Azure Static Web App service - app hosting offering for static web applications built on JavaScript. Automatic deployments to production and staging environments are implemented as GitHub integrations. Although currently in public preview this service is easy to set up and getting started. It will probably be one of developers favorite service in near future.
Xamarin Forms turns to .NET MAUI – single project and code-base dev experience
Yesterday Microsoft announced .NET Multi-platform App UI (MAUI) – the effort to turn Xamarin Forms apps use single cross-platform code-base targeting multiple platforms. Demos from Build conference yesterday gave clear signal – it’s not just an experiment but real deal. They really had single project running on Windows desktop and iPhone. This blog post is short overview of what’s coming.
Hosting WordPress behind Azure Front Door
During lockdown I tried out how Azure Front Door works. It is another member of Azure load balancers and traffic routers world but it is global and designed for web applications. My only interest was to see how it works and if it is just for commercial sites or does it also fit for private WordPress blogs like I have. It was interesting journey full of of surprises and here’s the overview of what I did and how things worked out.
Using Dapper in ASP.NET Core applications
Times ago I blogged about micro ORM-s. I have been busy through all Covid-19 times learning technical side of DDD and during that I met again my old friend Dapper. There are applications where Dapper is used to query read-only data without overhead coming with ORM-s. Also there are simple applications where for one or another reason developers decided to keep as close to raw SQL as possible. This blog post is brief introduction to Dapper anbd how to use it in ASP.NET Core applications.