Image from Pexels
Tagged articles - C#
Found 189 articles tagged with C#
21
Nov
2018
Adding healthchecks just got a lot easier in ASP.NET Core 2.2
.NET229 titlesSetting up and using healthcheck endpoints in ASP.NET Core 2.2
0
Health checks or health probes are the crucial part for orchestrating micro services. If you are using Kubernetes for orchestrating containerized application instances or you just have multiple ServiceApps or VMS behind the load balancer, you need to define health checks in order for the orchestrator or load balancer to know to which instance to send the traffic and to which not...read more
20
Nov
2018
Mocking IConfiguration GetValue<T> extension methods in Unit Test
.NET229 titlesHow to mock extension methods for IConfiguration in .NET Core
0
Now here is a trouble that was bugging me for some time and I guess who ever is using IConfigration injected in the constructor and using extension methods to access configuration values reached whan trying to write Unit Tests.
IConfiguration interface is a great way to easily replace your configuration layer in application, but it has it's drawbacks. The way interface envorces configuration reading is by exposing GetSection method which return IConfigurationSection...read more
11
Nov
2018
Handling data concurrency in EF Core and ASP.NET Core WebAPI
.NET229 titlesData concurrency in Entity Framework Core
0
Entity Framework Core implements optimistic concurrency strategy which is opposite to pessimistic concurrency strategy. Lets's first clear out what are main differences between these two approaches in concurrency control.
Optimistic concurrency control allows multiple processes to access and modify data without any explicit lock on the data...read more
04
Nov
2018
Setting up Swagger to support versioned API endpoints in ASP.NET Core
.NET229 titlesAdding Swagger support for versioned REST Web API endpoints
0
Versioning of your endpoints is important especially if you have 3rd party dependent clients of your REST API service. Any change in your endpoint, for example in data structure may impact clients even if it is backward compatible, clients may process your endpoint data in different ways, so even adding one additional property to your model may also impact functionality of the client which is consuming your endpoint.
Prerequisites
...read more
20
Sep
2018
Different ways to auto-generate Docker image tags
Docker3 titlesVarious ways to auto-generate Docker image tags and use latest tag
0
Tagging Docker images is important to keep track of versions of the service running and to easily roll back in case of faulty behavior of the application. The version strategy which is the most clear and understandable is tagging image with version of the application for example
...read more
11
Sep
2018
Setting up .NET Core development environment on Ubuntu Linux
.NET229 titlesA quick guide for switching from Windows based Visual Studio 2017 to Visual Studio Code
0
With growing popularity of dotnet Core, Git and Docker, developers who used to work mainly on Windows are now getting used to CLI environment and obviously Linux. Windows is still a development environment platform of choice, bit since Microsoft already developed and published Visual Studio Code as a cross platform IDE for Windows, Linux and Mac.
Although it is still not mature as Visual Studio 2017, it is a decent tool for .NET Core applications development...read more
08
Sep
2018
Reloading the cache automatically once expired is ASP.NET MVC
.NET229 titlesLoad values to in memory cache as soon as they expire in ASP.NET MVC
0
In memory caching is not a bullet proof way of caching data in an application, especially if this application is distributed. The lack of synchronization between nodes can cause you application to misbehave showing wrong data or even throwing exceptions and crashing. This is one of the main reasons why distributed caching is the best way of doing the caching in your web application.
But not all applications you might be developing need to run as distributed on multiple machines...read more
14
Aug
2018
Minify ASP.NET MVC Core response using custom middleware and pipeline
.NET229 titlesHtml response content minification on the fly in ASP.NET Core
0
For my website, since it runs on Umbraco 6 and it is basically ASP.NET MVC application. To reduce load time and increase website performances I decided to alternate the response of the application and minify it using simple regular expression.
Initially I was trying to do this with YUI Compressor library which has .NET port as NuGet YUICompressor.NET which works fine in most of the cases, but in my case does not skip PRE tags which I use for code snippets on the website...read more
09
Aug
2018
Background working scheduled task in ASP.NET Core MVC application
.NET229 titlesUsing Quartz for scheduling background tasks in .NET Core MVC applications
0
Caching common data like lookups for example in memory of your app can increase significantly your MVC web application performances and response time. Of course this data has to be periodically refreshed.
You can use various approaches to refresh data including expiry, but this can create potential bottle necks in your application since once data expires, you will use request thread to pull the data, cache and serve the request response back...read more
04
Aug
2018
Simple pixel conversion tracking implementation in ASP.NET Core WebApi
.NET229 titlesConversion tracking implementation using pixel method in ASP.NET Core
0
Pixel tracking, although it is the oldest method for tracking conversions in marketing, it is still used widely and some big companies like Facebook are still overing it as one of the methods for tracking the conversions of on your web pages. Tracking conversion via pixel method is still widely used because of it's simplicity...read more
03
Aug
2018
Limit number of tasks running at the same time in .NET
.NET229 titlesHow to throttle number of running tasks to a specific number in C#
0
Limiting the number concurrently running Tasks is not that often requirement in a code, but eventually you'll find yourself in the situation that for the most likely performance issues you'll have to limit number of concurrently running Tasks.
One of these situations is when you have long running operations in the Task. If you spin up to many Tasks you will seriously degrade your application performance...read more
06
Jul
2018
How to get client IP Address in ASP.NET Core 2
.NET229 titlesFetching client IP address in ASP.NET Core
0
As ASP.NET was evolving, there were different ways accessing client IP address from the request. The way to do it WebForms and MVC Web application is simply accessing request of the current HTTP context
...read more
27
Jun
2018
Building advanced .NET Core Global Tool using CommandLineUtils package
.NET229 titlesOverview on the new feature in .NET Core 2.1 and how to build and use your own tool
0
Microsoft introduced a new feature called Global Tool with the new .NET Core release 2.1. Essentially, global tools are simple console applications which can be invoked from the console...read more
25
Jun
2018
Generate C# models from Protobuf proto files directly from Visual Studio
.NET229 titlesGenerating C# classes inside .NET Core project from proto using protogen
0
I wrote about boosting performances by choosing the right serialization in .NET projects. The top best performing according to my tests and many of the online comparisons are Apache Avro and Google Protocol Buffer (Protobuf) serialization...read more
21
Jun
2018
Token based authentication and Identity framework in ASP.NET Core - Part 3
.NET229 titlesSetting up asymmetric key token based authentication in ASP.NET Core application on top of Identity Framework
0
Recently I wrote about setting up .NET Core Identity Framework and Token based authentication in ASP.NET Core using symmetric key signing. The downside of this approach is that both identity and resource server share the same key for signing and validating the token...read more
.NET
5
Jun
2022
Using dotnet nuget package vulnerability scan in Azure DevOps build
Listing nuget vulnerabilities and controlling build in Azure DevOps
5
May
2022
Protecting static files in ASP.NET Core using custom middleware
Restricting access to specific static content with middleware in ASP.NET Core
20
Dec
2021
Supporting multiple authentication schemes in asp.net core webapi
Using more than one authentication schemes in webapi projects
12
Dec
2021
Controlling the flow of migrations in EF Core
Altering EF Core migrations execution order
28
Nov
2021
Unit of work pattern with Dapper
Implementing unit of work pattern with Dapper in .NET 5
21
Sep
2021
Adding display name to Enum values
Implementing additional values for Enum items in C#
JavaScript
28
Oct
2018
HTML5 localStorage with expiry with vanilla JavaScript
Using HTML5 localStorage with expiry
8
May
2018
Monitoring DOM changes with JavaScript
Handling DOM changes with plain JavaScript
9
May
2017
Non blocking CSS load on the page
Load external CSS files in an async manner
16
Mar
2017
Serialize html form to JSON without using JQuery
Transform user input from HTML form fields to JSON
17
Jan
2016
Copy text value to clipboard using jQuery
Simple sample of using jQuery to copy value to clipboard
11
Jan
2016
Resize image on the client side with JQuery
Reducing the upload sie by resizing image on the client side
SQL/T-SQL
22
Feb
2022
Select column names with values from SQL Server database
Fetching column names with its value in T-SQL using built in JSON methods
23
May
2020
Identifying opened connections for the specific application in SQL Server
Connection listing queries in SQL Server
3
May
2018
Reading JSON data in T-SQL on SQL Server
Extracting values from JSON string on SQL Server using T-SQL
28
Apr
2016
Create XML/HTML with T-SQL
Generating XML/HTML output in SQL Server
24
Nov
2015
IP address to octets split in TSQL
Split IP addresse into octets in SQL Server
20
Jul
2015
Getting first and last second of the current year, month and day
Using minimum and maximum date time in SQL query
Umbraco CMS
2
Mar
2018
Minify HTML output of your pages
Minification of HTML output using ASP.NET IHttpModule
18
Apr
2015
Generate sitemap.xml on the fly in Umbraco CMS
Simple sitemap.xml Umbraco handler
2
Mar
2015
Accessing UmbracoHelper in HttpHandler request
Working with UmbracoHelper and IPublishedContent in HttpHandler
14
Sep
2014
Same page language switching in Umbraco
Land on the same page in different language in Umbraco using Relations
4
Sep
2014
Getting cropped image the smart way
The way to get cropped image URL with option to load original image too
27
Aug
2014
Fastest way to return JSON result from a controller
Resturn JSON in MVC controller action