It's my domain and I can say whatever I like (Five year blog anniversary)

Five years back, at this very same day I started my journey in the world of blogging. I know it's nothing to brag about. However, since it's my own domain, I can say anything I want. But seriously, there have been many ups and downs. There were times when I literally wanted to stop blogging. Although the reasons were silly enough to make anyone say "This guy is a stupid". But again, aren’t we all stupid? Ask yourself why do you read blogs? Isn't it the very same reason…

Keep reading

Live Unit Testing in Visual Studio 2017 Enterprise

Live unit testing is only available in the Enterprise editions of Visual Studio 2017 Version 15.3.0 or later I used to hate writing tests for my projects. But not so long ago, I was forced to change my perspective on that once I start managing big enterprise level applications. As a newbie in the world of TDD (Test Driven Development) what I expect from any IDE is, Quickly show which parts of my application code is covered by unit testing and which are not. Yesterday, I saw the…

Keep reading

Faking with In Memory Database In ASP.NET Core 2.0

Alright, I messed up between the terms: faking and mocking when one of my friend asked me "How are you faking in .net core?". I told him with my little to no knowledge about faking that, "Use the Moq library". But later found that I was totally wrong. And mocking is not actually faking. Then I read a lot of articles/blogs on those topics and came across with this beautiful blog post by Martin Fowler on Mocks Aren't Stubs. Take your time and read it to get your facts…

Keep reading

Lazy-loading NgModules in ASP.NET Core AngularSPA

Angular has this cool feature of loading a module lazily. Modules that are set up to load lazily can significantly save application startup time. Lazy-load module set up is done in application's routing configuration section. As the title suggests we will be using the AngularSPA template shipped with Visual Studio 2017 Preview (2) for demonstration. Route that is configured to lazy-load a module sends an HTTP GET to the server which in turns return the module in a chunk of code block. This only happens when the router is activated…

Keep reading

Cache headers for MVC File Action Result (ASP.NET Core 2.0)

You typically work with one of the following action results when you want to write a file to the response. FileContentResult (writes a binary file to response) FileStreamResult (writes a file from a stream to the response) VirtualFileResult (writes a file specified using a virtual path to the response) These are all coming from ASP.NET Core's MVC package. In earlier version of ASP.NET Core (1.*); using these action results, you could have served files but there wasn't any way of configuring cache headers for the responses. I'm pretty…

Keep reading

Entity Framework Core Triggers in Action (Unofficial Package)

Recently I have had this problem of updating a field of an entity that is dependent on another field of another entity. Confused already? Let me give you an example: so, I've these Inventory and Item entities where there exists a many-to-many relation between them. So, of course there should also be a relation table between them i.e. InventoryItem. The problem I was having actually is I have had this one field called CurrentQuantity on the Item entity and other called IssuedQuantity on the relation table (InventoryItem). Thus, as…

Keep reading

Handling Boolean Types on Angular with Pipe

This post shows you how you can handle .NET Boolean types on Angular client using Pipe. The Pipe formerly known as Filter in AngularJs is an Angular (2,3,4) framework feature that helps transform data. Here goes a very simple pipe which converts a boolean value to a specific Yes/No string. import { Pipe, PipeTransform } from '@angular/core'; @Pipe({ name: 'questionableBoolean' }) export class QuestionableBooleanPipe implements PipeTransform { transform(value: boolean): string { return value == true ? 'Yes' : 'No' }; } Next, make the questionableBoolean pipe globally available so that you can use it…

Keep reading

ASP.NET Core API Versioning in Simple Words (Update 1.2.0)

Few days ago, me and my friends developed an API using ASP.NET Core where from the GET method we returned some data to our client app. We did pagination in the front end. Means that first we sent all the data to the client and then did some data.length operation on that to get the items count for applying pagination logic. Then decided that we should do the logic in the back-end (server-side pagination) because it will decrease the payload of the HTTP request. In our case it…

Keep reading

Terms we don't fully understand while learning ASP.NET core

There are some terms, developers like me often ignore while learning ASP.NET Core. Because at the end of the day it's all about making apps not learning stuff. But having a basic understanding over the core concepts can make you a lot better developer than you already are. So, this article will clear the concepts of some of those ignored and misunderstood terms in details. This article is upgradable with new topics. So, if you have other topics such as below and want it here, please make a comment…

Keep reading

Adding Angular Material in ASP.NET Core Angular SPA template (Bonus : Animations)

If you are not familiar with ASP.NET Core SpaServices, take a look at this repository: https://github.com/aspnet/JavaScriptServices/tree/dev/src/Microsoft.AspNetCore.SpaServices Lots of SPA templates (Angular, React, Vue, Aurelia etc.) are available in this repo that uses NodeServices for server side rendering. We will work with the AngularSpa template and add Angular Material in it. To install the Spa templates via yeoman, first intall the template generator with the following command: npm install -g generator-aspnetcore-spa@next Create a directory where you will initialize the…

Keep reading