ConfigureAwait (sometimes) Saves the Day Everytime!

I get in a lot of fights.

Fights about async/await anyway. Despite async/await being over 5 years old (AOTW), there still remains a lot of confusion regarding some basic functionality.

I do not presume to be an in-depth expert. Some of the things I read from Stephen Cleary or Jon Skeet make my eyes go crossed. But for your average, everyday usage, it doesn’t need to be so misunderstood.

I am not going to rehash the excellent articles that explain these things. I am going to share a WPF application that demonstrates some of the commonly misunderstood pitfalls so you can actually observe the things you read about by the experts like Stephen Cleary, Stephen Toub, Jon Skeet.

Introducing “WPFGui”…. This is a simple Windows Presentation Foundation application that will attempt to update the UI on each of the button clicks. Of course I don’t need to update the UI directly with MVVM, but this is a contrived example after all….

Continue reading

Advertisement

Custom Serilog Sink Development

sink
The code shown here is part of a VS 2015 solution hosted on GitHub.

If you are coming to this blog post you probably already know what Serilog is and you need to write to a “sink” that is not already provided in the list of Available Sinks. The list is quite long so definitely look closely before developing your own because there is most likely one already built for  your needs.

But what if there isn’t? Continue reading

A Basic Example of CRUD with DataGridView in VB.Net

Intended for new developers, or at least new to ADO.Net, this post will demonstrate how to Create, Read, Update and Insert data into a MS SQL Server database. We will use a VB.Net winforms project, DataGridView and SqlDataAdapters. You can pull down the complete project from GitHub here.

UPDATE: I have also published a similar example application done with Code First EntityFramework 6.

The finished Form looks like this:
finishedform
Continue reading

Restore SQL Server backup to localdb in Visual Studio

The Visual Studio integrated tools for SQL Server are getting better all the time. While working solely in VS might not always be optimal, it is very convenient to not have to switch over to SQL Server Management Studio to do simple queries. Although the VS SQL tools may not be full-featured, you might just be able to get by with them and not need to install SSMS at all.

One of the less intuitive things to do is to restore a backup file that was created on another server. In this post I will show you how to easily do this in the absence of a right-click restore shortcut. For this you must run the SQL for RESTORE.

Continue reading