How can you use .NET framework class libraries in a .NET Core application?

  • Class libraries which are built against .NET framework can be referenced and used inside a .NET Core application starting from .NET Core 2.x by means of a Compatibility Shim that was included in the .NET Core 2.x
  • .NET Framework and .NET Core are based on different BCL (base class libraries). The code can be reused, but if the class libraries make use of any .NET Framework BCL specific references (such as Object types - which are different in .NET Core), the application might throw runtime exceptions.

Where is Session stored?

  • Session is stored on the server-side while the ID of the session resides on the client browser as a Session cookie.
  • In the server, the Sessions are managed by the module w3wp.exe

What is the difference between SingleOrDefault() and FirstOrDefault() methods?

  • Both SingleOrDefault() and FirstOrDefault() LINQ methods return default value of the passed collection data type when there are no matching elements found for the condition predicate.
  • Both methods return only one record from the collection that matches the predicate.
  • SingleOrDefault() expects the condition predicate to match only one record in the set - for example, a postUrl in a collection of BlogPost objects. If there are more than one objects that match the predicate, SingleOrDefault() method throws exception.
  • Whereas the FirstOrDefault() method returns the first object in the collection that matches the prerequisite and so no such exception is thrown.

How to use Filters in ASP.NET Core

Filters are components built into the ASP.NET Core which can help us in controlling the execution of a request at specific stages of the request pipeline. These come into picture post the middleware execution, when the MVC middleware matches a Route and a specific Action is invoked.

Creating a Simple RSS Feed with ASP.NET Core Web API

While the terminology might seem alien to us, but at its core its just a web service which returns data from its data source in a predefined XML schema called as RSS. In this article, let's build a simple endpoint in our ASP.NET Core WebAPI which can return RSS feed from a Posts database.