bitScry - Blog

C#

About this site

This is a blog to help me remember some of the coding challenges I’ve faced and hopefully help others out if they’re suffering the same problems.

Recent Posts
  • Adding a Sonoff Zigbee Dongle Plus P Router to Zigbee2MQTT
  • Configuring Raspberry Pi 5 with NVME Hat
  • Pass Through an iGPU to Frigate from Proxmox
  • Creating a Frigate VM on Proxmox
  • Enable Remote Root SSH Login
Tag Cloud

.NET .NET Core AAD API appsettings.json ASP.NET Core Authentication Authorization Azure Azure Active Directory Azure Function Azure Storage Blob Bootstrap C# Cloud Storage Console Application CSS CSV DataTable Dependency Injection Dictionary Docker Entity Framework Enum Extension HTML Image JavaScript jQuery JSON List MVC Newtonsoft Raspberry Pi RestSharp Serilog SQL Stored Procedure Stream Table Table Storage Web App Web Application WordPress

Copyright
Creative Commons License Any code within by is licensed under a Creative Commons Attribution 4.0 International License.
Programming

Getting the Windows User Name in ASP .NET Core

If you want to get a users username in a site that uses authentication then you can just use the User object and that will provide all claims associated with that user. However if you want to get the username for a user where they’re not required to authenticate first Read more…

By Shinigami, 5 years ago
Programming

Using OData with Entity Framework

OData is an open protocol for enabling interaction with a datasource in a standardised way via a RESTful API. Theoretically using OData in combination with Entity Framweork should provide a simple way of providing access to SQL (or other) data via API, this is indeed the case but setting things Read more…

By Shinigami, 5 years ago
Programming

Using OData with Bootstrap Table

Bootstrap Table is the best way I’ve found of adding additional functionality to HTML tables. One of the nice features about it is that it will load data from a URL if it’s provided in the correct JSON format which allows the data provision to be decoupled from the page Read more…

By Shinigami, 5 years ago
Programming

Escaping the @ Symbol in an MVC View

I’ve been working with OData recently and one thing that briefly stumped me was that the property names begin with @ and in an MVC view the @ symbol is used to indicate C# code so when I tried to reference a property in JavaScript the page then thought I Read more…

By Shinigami, 5 years ago
Programming

Creating C# Classes from SQL Tables

If you want to use Entity Framework to access pre-existing SQL tables (the database first approach) then providing they’re all keyed up correctly it’s possible to generate all the required classes and the DB context for them with just a few commands. First you need to install the following 3 Read more…

By Shinigami, 5 years ago
Programming

Publishing Additional Files in Visual Studio Code

When creating a console application I normally mimic ASP.NET core apps and keep my configuration settings in an appsettings.json file. When publishing the application in Visual Studio the appsettings.json file needs to have it’s properties updated to ensure it’s copied to the publish folder like so. Doing this updates the Read more…

By Shinigami, 5 years ago
Programming

Dependency Injection in Azure Functions v3

In the v3 version of Azure Functions DI is better supported and there’s now some offical documentation demonstrating how it’s done. It’s pretty similar to how it was done previously, below is updated code from my previous v2 example. The IFunctionsHostBuilder instance is created by the Azure functions host and Read more…

By Shinigami, 5 years ago
Programming

IAsyncEnumerable Disambiguation

I’ve been using IAsyncEnumerable recently for the streaming of SQL query rows and of deserialized objects from API calls and while it seems to work like a charm it does seem to have a few configuration issues. Firstly, on creating a new .NET Core project in Visual Studio 2019 (v16.3.5) Read more…

By Shinigami, 5 years ago
Programming

Streaming API Data into SQL

As part of a recent project I’ve had to download a gzipped file of product details from a client endpoint and to load these products into a local SQL database. Although this is easy enough to do in discrete synchronous steps as below what I really wanted to do was Read more…

By Shinigami, 5 years ago
Azure

Azure Storage Authentication Using Managed Service Identities

I usually access Azure Blob Storage by using a SAS key but I am trying to move everything over to KeyVault and Managed Service Identities (MSI) to improve security and secret management. During this process I kept on receiving the following error. I could connect to the container using my Read more…

By Shinigami, 5 years ago

Posts pagination

Previous 1 2 3 4 … 8 Next
  • About
  • Blog
  • Contact
  • Create your website with blocks
  • Sample Page
  • Sample Page
Hestia | Developed by ThemeIsle