Web Development And .Net Articles, Tutorials, Discussions

.Net

In this post, I’m going to describe how we can configure Serilog with Asp.Net Core 2 web and Api projects. I also configure Serilog to work with SQL Server database to store the logging information. Then I’ll write an extension method and use the built-in exception handling middleware to log exceptions in production environments. What … →

In my previous post, I’ve discussed how we can implement policy-based authorization to secure our API using JWT. But that wasn’t what I end-up using in production. Partly because the built-in mechanism of Asp.Net Core with JWT is not as powerful as IdentityServer4. Also I needed the single sign-on feature of IdentityServer4. There are two … →

One of the hallmark of a good unit test is its maintainability. The test that is not maintainable is a pain and there is a higher tendency for it to be ignored. One of the mistakes in software testing is Over-specification of tests. This problem often comes with testing object interaction with a mock object when … →

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 … →

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 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 … →

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 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 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 … →

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 … →