Thoughts on .Net & Coding

.Net Articles, tutorials, reviews, code and more...

  • Use IHttpClientFactory to invoke Web API in ASP.NET Core

    If you have worked with ASP.NET Core Web APIs before, chances are you used HttpClient to invoke them. Although instantiating HttpClient directly is a common way of using it, there is a better alternative. Rather than instanting HttpClient yourself you can use IHttpClientFactory to obtain an instance of HttpClient. The HttpClient object thus obtained can be used to invoke the Web API. In this article I discuss three ways to obtain an HttpClient instance using IHttpClientFactory.

  • .NET Standard for Absolute Beginners

    If you are a beginner in ASP.NET Core chances are at some point in time you stumbled upon this - .NET Standard. You probably wondered what it is and how is it different than .NET Framework and .NET Core. Although you might have heard this term, while developing your ASP.NET Core apps you might not have bothered about it at all. This might have made you wonder even more as to what's the use of .NET Standard if it's not actively used while developing your apps. You might have also felt bit confusing about the version number that accompanies .NET Standard. This article attempts to explain all these questions about .NET Standard from beginner's perspective. My aim is to quickly enable you to grasp the concept and utility of .NET Standard and I also provide pointers for more detailed understanding.

  • CRUD using gRPC, EF Core, and ASPNET Core (Part - 3)

    In Part -1 and Part - 2 of this article you created EmployeeCRUD service definition using Protocol Buffer language and also implemented it in EmployeeCRUDService class. So, our gRPC service is now ready. In this part we will consume the service in an ASP.NET Core MVC application. Begin by opening the GrpcService1 project you created earlier. Add a new ASP.NET Core MVC application in the same solution. Then copy the Protos folder from the GrpcService1 project into the newly created MVC application. At this stage your Solution Explorer will look like this.

  • CRUD using gRPC, EF Core, and ASP.NET Core (Part - 2)

    In Part -1 of this article you created EmployeeCRUD service definition using Protocol Buffer language. The EmployeeCRUD.proto file and EF Core model is now ready. In this part you will create the EmployeeCRUD service based on the structure defined in the .proto file. To begin, open the project created in Part -1 and expand the Services folder. Rename the service file to EmployeeCRUDService.cs. At this point the Solutions Explorer will look like this.

  • CRUD using gRPC, EF Core, and ASPNET Core (Part - 1)

    If you have read about the new features of ASP.NET core 3.0, you are probably aware that it supports gRPC, a framework for building services using Remote Procedure Call (RPC). I won't go into the dry information about what gRPC is and how it can help you solve software problems in this article. This multipart article creates a simple yet complete example that performs CRUD operations on the Employees table of Northwind database. As you develop this example you will get chance to familiarize yourself with the basics of gRPC as implemented in .NET Core 3.0.

  • Push data to client using ASP.NET Core Web API and Server Sent Events

    Server Sent Events or SSE allow you to send push messages from the server to client. They come handy when you have a lengthy processing going on the server and want to notify the client from time to time about the status or intermediate results of the processing. In this article you will learn how SSE can be used to push data from Web API to the JavaScript client.

  • JSON to XML / XML to JSON conversion in .NET Core

    JSON is a preferred format for transferring data over the wire in modern web apps. However, at times you need to deal with XML data format. Moreover, you might want to handle JSON and XML in the same application. For example, you might be receiving data in JSON from a Web API and then you might want to feed it to another service that expects input in XML format. Such situations are common when you are integrating old and new software systems.

  • Upload Files Using jQuery Ajax and JavaScript Interop in Blazor

    Uploading files from client machine to the server is one of the fundamental operations in web applications. In ASP.NET Core MVC applications you can accomplish this task easily using HTML5 file input field and server side logic. However, Blazor doesn't have any built-in facility (so far) for uploading files. You either need to use some third-party solution or device your own technique to accomplish the task.

  • ASP.NET Core 3.0 - Ten features beginners should know

    If you are tracking the progress of ASP.NET Core, you are probably aware that .NET Core 3 and ASP.NET Core 3.0 are being released at .NET Conf 2019. There are many exciting feature additions and improvements to the latest version of ASP.NET Core. You might have already stumbled upon the prominent ones. In this article I am enumerating over ten features / improvements for beginners that are worth noting. My aim is to quickly mention them here so that you can explore them in more detail by visiting Microsoft's official channels such as product documentation and Channel 9.