More often than not some deployment strategies involve file overwriting, such as in the case of Sitefinity projects. This manual deployment process typically takes the following steps:
1. Identify files that are modified or created
2. Obtain the files and put them in a new folder
3. Organise the files to follow the original structure
4. Zip the folder
5. Upload to production server
The above mentioned process is tedious and is prone to human mistake as the number of files involved scale up. Fortunately the process can be automated with a single Git command:
git archive --output=package.zip update_commit $(git…
Chain of responsibility is a behavioural design pattern that allows a response to be passed along a chain of handlers. Each handler receives the request in sequence and optionally acts on it before passing it on to the next handler. This design pattern is useful to cases where processing of a request is done in a sequence of steps. By using handler for each of the step, the code can be loosely coupled with the main program and easy to maintain in the future.
One example of using this design pattern is dealing with an interactive Q&A where question is…
The goal of unit testing is to segregate each part of the program and test if that individual part is working correctly. This is the practise that improves the quality of code, enables bugs to be found at early stages, and facilitates any future changes and refactorings. This article talks about the steps on transforming a custom Sitefinity widget to be unit testable and how to perform it.
Sitefinity is a CMS that allows developers to use ASP.NET MVC to build custom widgets. …
xUnit is a unit testing framework which supports .NET Core . I use it to unit test my Document Controller WPF application (.NET Framework 4.6.1) and in this project, the AutoMapper is heavily used to map domain models to view models.
I wrote unit tests for each class and when the unit tests were run, I got the following error:
System.InvalidOperationException: 'Mapper already initialized. You must call Initialize once per application domain/process.'
This error is due to the design of xUnit (Version 2.4.0) and AutoMapper (Version 7.0.1). xUnit groups tests (methods that have the attributes fact or theory) by their…
This is the first minimal viable product that has been published and used by the company.
The first version of the Document Controller is a WPF application which can be installed and launched in any Microsoft Windows Operating Systems with .NET Framework 4.6.1 installed. This application works hand in hand with a database in Microsoft Access format which is available in the company local network drive. It was completed on 23 November 2018 with the git tag
v-1.0.0 being used to label the corresponding git commit in the source code repository.
Among the several core features of this application are:
I fell in love with programming when I first learnt C during the first year of my undergraduate study. Little did I know that was the beginning of my lifelong relationship with it (ok, I admit it was not really that long 😅). After I had the first contact with C, I started to learn C# and immediately noticed the beauty of this high-level object-oriented programming language. I made use of it in my internship to develop an application to automate performance test analysis. …
Document control system has always been important to any company and organisation to ensure the existence of controlled process and practices for the creation, review, modification, issuance, distribution, and accessibility of documents. Unfortunately, as someone who is tasked to take on this role, I have noticed that the document control system in my company has been inefficient and ineffective:
Web API often needs to be protected from malicious users. This article aims to show how simple authentication and authorisation can be implemented in a sample ASP.NET Core Web API app (“sample app”).
I have used the following tools to build the sample app:
With authentication and authorisation implemented, my sample ASP.NET Core Web API app only accepts HTTP request with valid JSON web token (JWT)…
Upon completing the server app and having it tested while coding using Postman, I have felt that it has become a good time for me to deploy the project and host it in an actual server machine. Like most developers who are relatively new to server development and ASP.NET Core, I frequent Microsoft documentation site for official instructions on using their technologies.
Basically, the steps involve: