I’ve been tinkering with different options to secure the API endpoint of one of my Asp.Net Core apps. What I end up using was IdentityServer4, primarily because my app needed Single sign-on too. But for straightforward scenarios, I think IdentityServer4 is an overkill. That’s where JWT comes in, so in this post, I’m going to …
.Net
.NET is a large collection of a bunch of different things really; including compilers, runtimes, programming languages and a bunch of different tools and technologies.
It provides a lot of common functionality that can be tapped into rather than recreating it from scratch.
C# is one language that can be used on .NET. It get compiled initially by Roslyn and can get additional compilation at runtime by RyuJIT. Other languages include F#, which can all be compiled and run against its runtimes.
This works because it’s generally not compiled to a particularly low level language but rather to an Intermediate Language that can be executed by a .NET runtime. The runtime then does the appropriate translations to actual system/hardware calls allowing you to not have to worry about it.
When you create at least C# projects, you have to specify what runtime you’re targeting so that it can be compiled appropriately to work; not just whether it’s Framework or Core, but also the version number since functionality of the same thing may be different.
One of the goals with .NET 5+ is to reduce the confusion by bringing many of the parts together under one umbrella, but it’s going to be a while before that replaced enough existing software to really get rid of the confusion (especially since .NET 5 isn’t going to have Long Term Support).
Isolation Frameworks: Why FakeItEasy and NSubstitude Are Better Than Moq
I’ve been trying out different isolation frameworks lately and reading about their features and differences. In terms of feature, most constrained isolation frameworks are almost the same. But there are couple of important points about naming and readability that I think worth paying attention to. I’ve used Moq in my previous projects, but recently, I’ve …
Moq: Working With SetupGet, VerifyGet, SetupSet, VerifySet, SetupProperty
Moq has a set of methods specific to stubbing and verification of properties. In this post I’m going to go over each one of them, and explain when and why to use them. I also discuss their differences and in what situation we might want to use them. Let’s assume we have an interface with …
LINQ To Entities – Balance Between Cost Of Database Calls And Data Volume
I was performance tuning some of the rushed queries on one of the web apps that I’m currently work on. What I’ve realized was writing efficient LINQ queries requires a little more effort than I thought. In this post I’m going to show you some of the issues I’ve encountered and the lessons I’ve learned …
Asp.Net Core Action Results Explained
Asp.Net Core has a set of action results which are intended to facilitate the creation and formatting of response data. Without a well formed correct response, our application cannot work correctly and efficiently. Therefore action results and as a whole mechanisms that are responsible for generating the response are an important part of an Asp.Net …
xUnit Theory: Working With InlineData, MemberData, ClassData
xUnit support two different types of unit test, Fact and Theory. We use xUnit Fact when we have some criteria that always must be met, regardless of data. For example, when we test a controller’s action to see if it’s returning the correct view. xUnit Theory on the other hand depends on set of parameters …
12 Visual Studio Extensions You Might Find Useful
I previously wrote about some Visual Studio extensions that I though was most useful here. I think that list still stands. But in this post I’m going to introduce less known extensions that I think might be useful, but not essential. Viasfora Viasfora adds tons of features to your code formatting experience. From code rain …
How To Show Currently Online Users (Members) Using Asp.Net MVC And Identity
How To Show Currently Online Users (Members) Using Asp.Net MVC Identity Introduction In this post, I’m going to show how to implement online users feature using Asp.Net MVC Identitiy. In the old Membership system of ASP.NET, things were a little easier, you could get the list of all users, also you could see who is …
Customizing ELMAH To Prevent It From Logging Unnecessary Errors Using Entity Framework and ASP.Net MVC
Couple of months ago, I needed to use ELMAH in one of my project (in case you haven’t heard about it, you can see what it can do for you here), but the component out of the box had some problem in my opinion. for example when an error occurs, it goes ahead and log …
Asp.Net Core attribute routing new features and differences with MVC 5
One of the most important changes in Asp.Net Core was mixing the WebAPI and MVC. Now they are not two separate things, Asp.Net Core now contains both of them, that means these two technologies are going to share the same code base for a lot of things, and attribute routing is one of them. In …