Blog

Blog posts on .NET, Azure, and more.

Default implementations in interfaces

May 14, 2019 by Anuraj

C# 8.0 C#

This post is about the new C# 8.0 feature Default implementations in interfaces. This feature helps you to provide an implementation for your new method in an interface. So you won’t break existing implementation by adding a new method. From the documentation - An interface member can now be specified with a code body, and if an implementing class or struct does not provide an implementation of that member, no error occurs. Instead, the default implementation is used.

Get all blobs in a container and change the content type.

May 13, 2019 by Anuraj

Azure AzureBlob

This post is about getting all the blobs in a container and change the content type. This tip or snippet is quite useful in scenarios where you want to change content type of big number of blobs. This is a tip or snippet more than a blog post. I faced this issue in my current project, where our application used to push images to Azure Blob, but we were not setting the content type, and by default the content type is application/octet-stream. Because of this, when we used to browse the URL, instead of displaying it in the browser, browser used to show a download prompt. In this I am using a dotnet core console app, which will get all the blobs and if the extension of the file is jpg, setting the content type to image/jpg.

Working with gRPC in ASP.NET Core

April 14, 2019 by Anuraj

ASP.NET Core gRPC

This post is about Working with gRPC in ASP.NET Core. gRPC is a language agnostic, high-performance Remote Procedure Call (RPC) framework.

Resizing Images using Azure Functions

April 05, 2019 by Anuraj

ASP.NET Core Azure Serverless

This post is about how to resize images uploaded to a blob storage using Azure functions. In my current project, system used to resize the image while uploading the image to blob storage. This approach got two major drawbacks - the process will take some time and the resize is implemented using System.Drawing - which is not recommended to use in Server side applications. By implementing a function - which triggers while someone uploads a photo to blob storage - using ImageSharp - resize the image. Since the code is very minimal I am using the Azure portal to build the Azure Function. In the portal, click New and Search for Functions, select Function App. And you need to provide a name, resource group and storage.

Using EF Core in a Separate Class Library

March 05, 2019 by Anuraj

EFCore ASP.NET Core

This post is about how to use EF Core in a separate class library. And how to use it in the ASP.NET Web API and how to run migrations to create database. One of the common design approach is split the application in to different layers or tiers. In this post, I will help you to split your models from MVC or API application and consume it.

Copyright © 2024 Anuraj. Blog content licensed under the Creative Commons CC BY 2.5 | Unless otherwise stated or granted, code samples licensed under the MIT license. This is a personal blog. The opinions expressed here represent my own and not those of my employer. Powered by Jekyll. Hosted with ❤ by GitHub