C# – Using SQL transactions with Dapper

Using TransactionScope is the simplest way to execute multiple SQL commands in a transaction. Here’s an example of how to use it: When you call TransactionScope.Complete(), it commits the transaction. If you don’t call Complete(), it’ll rollback the transaction once it leaves the TransactionScope block. This keeps the code nice and clean and works well … Read more

.NET Core – Check which OS you’re running in

.NET Core enables you to write cross-platform C# code. Sometimes you’ll want to do things differently depending on the OS you’re running in. You can use RuntimeInformation.IsOSPlatform() to figure out which OS you’re in, like this: Example – Loading a different native library depending on if you’re in Windows or Linux One practical example of … Read more