bitScry

  • Home
  • About
  • Blog
  • Contact

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
  • Mocking Hangfire BackgroundClient Jobs
  • Running Shinobi CCTV on a Raspberry Pi
  • Visual Studio CoreCLR Error
  • Adding Healthchecks to a .NET Core 6 API
  • Getting Location From IP Address
Tag Cloud

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

Programming

Grouping Azure Table Storage Entities

If you’re using Azure Table Storage then it’s often more efficent to perform operations such as insert, update, delete in batches rather than making seperate calls for each individual row. There can be up to 100 entities in each batch and each all entities in a batch need to have Read more…

By Shinigami, 2 years17 September 2020 ago
Programming

Best Practices for Using Azure SDK with ASP.NET Core

Mostly just a link to this article containing best practices. There’s some useful extension methods available from Microsoft.Extensions.Azure to make for easier dependency injection of the various Azure services. There’s also some good examples available here.

By Shinigami, 2 years9 September 2020 ago
Programming

JsonResult Serializer Settings in .NET Core3.1

If you are returning a JSON representation of an object from an MVC controller it may be necessary to determine how the JSON is formatted. This can be done using the JsonSerializerSettings object like so. This used to work as is with version 2 of .NET Core but with the Read more…

By Shinigami, 2 years20 July 2020 ago
Programming

Check if a Value is Present in Multiple Lists

If you have 2 (or more) lists in C# and you want to check if they have 1 or more values in common then you can use the following LINQ to check.

By Shinigami, 2 years14 July 2020 ago
Programming

Merging Dictionaries Together

If you have 2 dictionaries of the same datatype in C# which you want to merge together then you can use the following code. If a key exists in both of the dictionaries then the primary value will overwite the secondary value. In the above example secondaryDictionary will now contain Read more…

By Shinigami, 2 years2 July 2020 ago
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, 2 years5 May 2020 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, 2 years7 April 2020 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, 2 years3 April 2020 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, 2 years2 April 2020 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, 2 years2 April 2020 ago

Posts navigation

Previous 1 2 3 … 7 Next
  • Facebook
  • Twitter
  • Instagram
  • Email
Hestia | Developed by ThemeIsle