WebLog

Server-side, client-side, code snippets, scripts, automation, best practices, proven approaches, tips & tricks...

Partial update with PATCH using DTOs and AutoMapper in REST WebApi

How to partially update an entity in REST WebApi services with ASP.NET Core
0
Implementing partial updates on the REST API is probably the trickiest method to implement. Unlike PUT HTTP method where you pass the whole DTO when you are updating an entity, PATCH method is intended to update only one or few properties of the entity you want to apply change to...read more

Reading coordinates from the photo in .NET Core

Accessing GPS coordinates metadata of a photography using C# and .NET Core
0
Pretty much all models of digital cameras including smartphones have ability and usually by default store additional metadata along with the image itself taken. This data is stored in EXIF format and you can easily see it if you are a Windows user by checking the properties of the photography file...read more

How to have a REST with Azure serverless functions

Building REST API services with Azure Functions Serverless model
 
0
Serverless model is becoming more and more popular everyday and all major cloud providers like AWS, Azure and GoogleCloud are providing their own implementation of serverless cloud computing model. As more and more companies are shifting their infrastructure to cloud, serverless model becomes more and more popular mostly because it's cost effectiveness, easy setup and out of the box scaling and orchestration...read more

Speech to text mp3 audio files using Azure Cognitive Services and .NET Core

Transcribe mp3 audio files to text using Azure SpeechServices and C#
0
There is a big buzz about AI these days and major Cloud vendors like Amazon Web Services, Azure, Google Cloud are competing to bring better products to their platforms for variety of AI tasks. One of these services is speech recognition and generating transcription text from the audio. I recently worked on a project which involved transcribing large amount of daily generated audio recordings...read more

Running .NET Core on Raspberry PI with Raspbian Stretch

Setting up .NET Core on Raspbery Stretch Linux distribution running on Raspberry PI
0
Apart from running on Windows and Linux both x86 and x64 architecture, .NET Core is an ideal platform for IOT (Internet of things) projects because it can also run on ARM32 and ARM64. This means you can run it pretty much any device with both RISC or CISC processor architecture. If you are .NET developer or you are familiar with .NET platform and C# language, this means you can now write applications that run on Raspberry Pi which is based on RISC architecture by writing them in Visual Studio...read more

The best option to use for a return type in ASP.NET Core WebAPI controller

Choosing the proper return type for WebApi controller actions
0
Starting from .NET Core version 2.1, there are so far three types of WebApi responses that controller actions can return. All three types had it's own pros and cons but all are lacking in options to satisfy both REST and the high level of testability. The available response types in ASP.NET Core including recently released 2.2 version are ...read more

Registering multiple implementations of the same interface in ASP.NET Core

Multiple implementations of an interface in .NET Core Dependency Injection
0
Starting from it's initial release ASP .NET Core comes with built in dependency injection (DI) to help implement Inversion Of Control design pattern. This is not something new in .NET and apart from built-in DI in .NET Core, there are other libraries which provide same and in some cases even more advanced dependency injection implementation...read more

Setting up Kestrel port in configuration file in ASP.NET Core

Reading port from configuration file in Program class Main method
0
When running ASP.NET Core application as self-hosted using Kestrel, it will by default use port 5000 for listening for requests. This should not be a big issue since you can always proxy requests to port 5000. Problem occurs when you might want to have multiple applications on one host, or you simply cannot use port 5000 for security or any other reasons.Luckily, default port for ASP.NET Core application running on Kestrel can be easily changed, but in order to make it easily configurable there are few changes you need to make in your code in order to access IHostingEnvironment and IConfiguration implementation instances combined. ...read more

Using DisplayName attribute for model validation output in ASP.NET MVC Core

Returning DisplayName attribute value in model validation response in MVC Core
0
Model validation is an important part of request life-cycle and pipeline in MVC Core regardless whether you are building Web API project or ASP.NET MVC web application. Both project templates rely on the common ASP.NET Core platform therefore validation is pretty much the same in both type of projects. Because Web API and micro services are more popular nowadays, I am going to use Web API sample project to demonstrate how to modify validation response in MVC Web API Core project. ...read more

Dependency injection with custom MVC filter attributes in ASP.NET Core

Using dependency injection with custom ExceptionFilterAttribute in ASP.NET Core
0
Apart from adding your own middleware to the ASP.NET MVC Core application pipeline, you can control the response using custom MVC filter attributes and selectively apply them to either whole controller or controller actions. One of the commonly used MVC filter in ASP.NET Core is ExceptionFilterAttribute for handling error response in Wep API applications. It is easy to implement and I also wrote an article about Error handling in ASP.NET Core Web API few months ago...read more

Install multiple packages from Visual Studio package manager console

Adding multiple nuget packages to the project from package manager console
0
If you are using Visual Studio 2017 as your main IDE, than you are probably familiar and used at least once NuGet package manager console. You may know or maybe not, but NuGet Package Manager relies on PowerShell script and Package Manager Console is basically hosted PowerShell command line inside Visual Studio. This means, apart from NuGet commands, you can also execute PowerShell commands. ...read more

JavaScript

read more

Umbraco CMS

read more

.NET

read more

SQL/T-SQL

read more