How to create integration tests with Entity Framework (EF) core?

It’s not easy to create integration test with database, no matter whether you create queries directly against entity framework’s DbContext or you create your queries with repositary pattern which operate on your DbSets.

You need to always connect to your database to test your use cases with the real data or fake data you have prepared.

The good news is you can use the EF core’s in-memory database provider to tackle it easily.

More …

How to upload and download file in Angular 5+ and .net core

When you develop a web application in Angular for the front-end and C# or Java in the back-end, it’s frequently that you need to upload and download files.

Here is an example that may inspire you in your development.

<!-- Upload file -->
<input hidden #feeFile type="file" #uploader (change)="uploadFees($event)" accept=".xlsx, .xls" />
<button mat-button color="primary" (click)="">
  <mat-icon matTooltip="Upload fees" class="import-export-button">cloud_upload</mat-icon>
<!-- Download file -->
<button mat-button color="primary" (click)="downloadFees()">
  <mat-icon matTooltip="Download fees" class="import-export-button">cloud_download</mat-icon>
More …

SQL server full-text index and its stop words

Full-text index is different from clustered and non-clustered index in SQL Server.

Clustered and non-clustered index use a B-tree structure.

One table can have only one clustered index. And table data is physically ordered and stored into pages based on the clustered index. Page is the fundamental unit of data storage in SQL Server.

The table data is organized with root node (type: INDEX_PAGE), intermediate nodes (type: INDEX_PAGE) and leaf nodes (type: DATA_PAGE).

Clustered index structure:

More …

How to deploy react app to GitHub pages

Github-pages is very practical to host static websites, not only Jekyll based websites, but also Angular, React based static websites etc.

You don’t need to purchase a space for the websites hosting. It’s totally free! All you need is just a GitHub account. :)

More …

How to transform web config or app config by environment in visual studio

In software development, there are at least several environments to manage: development (DEV), staging (STAG or PRE), and production (PRD).

There will be integration (INT), user acceptance testing (UAT) in a more complete environment configuration.

It could be frustrating when managing all those environments because a small error in the deployment could generate an incident, or disaster!

Fortunately there is a cool tool to facilitate the environment management and software deployment in visual studio.

More …