Categories

11 articles in C#
C# JSON Parsing with Json.NET and JObject
Parsing JSON using C# can be a fiddly but with Newtonsoft’s Json.NET library it becomes a breeze. The library provides a number of types for parsing JSON which I find useful for hacking together tools to help work with big JSON structures. However, it can get a little bit confusing understanding… 
How to Mock HttpRequestData for Unit Testing in Azure Functions
It turns out that unit testing Azure Function Http Triggers is not straightforward. In particular, isolated functions that use the Built-in HTTP model . The built-in model passes HttpRequestData to the Run method and returns a HttpResponseData object. As an example, consider a function that… 
Global Error Handling in ASP.NET Core 8 with IExceptionHandler
Typically in a ASP.NET Core Web application our code may throw an unhandled exception for many unknown reasons. Consequently its advisable to wrap application code in a global exception handler using a filter or some custom middleware. ASP.NET Core 8 introduces a new interface called… 
Using Serilog and .NET to Write Logs to Splunk HTTP Event Collector
Splunk provides an HTTP endpoint, known as an Event Collector, which can be used to POST log messages directly to the Splunk database. In this article we see how Serilog can be used in an ASP.NET Core Web API to write messages into Splunk using the HTTP Event Collector. In enterprise scenarios the… 
Getting Started with the Azure Blob Storage .NET Client Library
Azure Blob Storage is Microsoft’s cloud storage solution for storing massive amounts of unstructured data. The solution is composed of three key resources: storage accounts, containers and blobs. A blob represents a file and a container organizes a set of blobs. A storage account is a high level… 
C# .NET 8.0 Connecting to Sybase ASE 16 via ODBC driver
It’s possible to use .NET Core and C# to connect to SAP’s Sybase ASE database using the AdoNetCore.AseClient library. It provides… a .NET Core native implementation of the TDS 5.0 protocol via an ADO.NET DB Provider However its not actually an official SAP driver and it is possible to connect to… 
Displaying Data With ASP.NET Core and jQuery datatables.net
Software systems often have to display a lot of data and people expect functionality like pagination, searching and sorting by default. The jQuery plugin datatables.net transforms a basic HTML table with a few lines of code into a fully functional data grid. Its pretty awesome! A few lines of code… 
ASP.NET Core Data Driven Bootstrap Treeview
Bootstrap provides some nice, clean components for structuring page content. You can also combine various styles to create new effects. In this article we will see how to combine List Groups with the Collapse plugin to create a tree like representation of some hierarchical data: Bootstrap… 
Dockerize an ASP.NET Core Application
Visual Studio provides excellent support for docker containers, but this does mean some of the complexities of the technology can get masked. In this tutorial we walk through the basics of building a docker container for a simple ASP.NET Core Web Application so that we can better understand the… 
ASP.NET Core Razor Pages Simple Web Template
Visual Studio 2022 provides a template for creating an empty ASP.NET Core application. Although this template requires a bit of work to get a Razor Pages website up and running, by using the empty template we can include only the libraries and template code that we actually need. Before we begin, if… 
Using HttpClient to access API resources
Oftentimes we will have the need to call into an API to load resources. HttpClient class provides in the System.Net namespace provides all the required functionality to interact with an API in the usual ways. In the example below, we have a C# POCO called CustomerRequest which is used to…