What Have I Learnt Programming an ASP.NET Core Web App? (Library Management System) Part 1

What Have I Learnt Programming an ASP.NET Core Web App? (Library Management System) Part 1

Photo by Émile Perron on Unsplash

I’ve started working with Microsofts .NET Core Framework. Specifically, ASP.NET Core. I typically work with Javascript, with NodeJS or React, but wanted to try out Microsofts .NET Core Framework. While researching where to start, I ran into the older ASP.NET for web development.

What is the difference between ASP.NET and ASP.NET Core?

ASP.NET is a web development framework for Windows only; its initial release was 17 years ago. The much newer ASP.NET Core is also a web development framework. However, it is cross-platform and runs a lot faster than the old ASP.NET applications.

What is an LMS — Library Management System?

A Library Management System, which I will refer to as LMS, is an Administration tool for owners of bookstores or public libraries, to manage their books, subscribers, and branches and more.

It is allowing them to track books, to see whether it is available at a different branch/store. Furthermore, keeping records on whether their members/subscribers have any outstanding payments and the books they’ve borrowed.

Why did I choose to make an LMS?

I’ve been looking for a project to put on my portfolio, which makes a good portfolio project.

Database

This project allows me to work with SQL. As a NodeJS developer, the standard database is MongoDB(NoSQL). Working on this project requires me to manipulate data in different tables.

Design Pattern

ASP.NET Core typically uses the MVC(Model-View-Controller) design pattern/architecture. MVC is also the same design pattern used with Express for NodeJS.

I also used the repository design pattern which I will mention later in the “Finally, What Have I Learnt?” section.

Clean Code

Building an LMS opens up the challenge to write an MVC application while trying to keep the codebase organised and tidy.

.NET & .NET Core Framework

Getting into the .NET framework opens up lots of opportunities as a software developer. Many developers are going into development with Javascript. However, I feel that web development alone is not all that interesting, which is where most JS jobs lead you too. Whereas, the .NET Framework is free, open-source, backed by Microsoft and is known to do more.

Where I’m at with the LMS?

I would say I’m a third of the way there. Only the Library controller works as of now. However, I will publish part 2 and 3 of this series for the Subscribers and Branches controller.

View code on GitHub: https://github.com/samsonnagamani/LMS

Finally, What Have I Learnt?

Connecting to SQL Server and any Database server can be confusing

When I started this project, I spent the better part of three days figuring out how to connect and interact with SQL Server. The first couple of tutorials I’ve watched, using code that did not seem to scale well. However, after researching more, I started using dependency injections, which is very scalable.

Photo by Kevin Ku on Unsplash

The Repository Design Pattern

A design pattern I learnt while making an LMS is the Repository Design Pattern. I won’t go into much detail, but in simple terms, there are three files.

  1. Model.cs
  2. IModel.cs
  3. MockModel.cs

Model.cs is where you define a model.

IModel.cs is the interface for Model, defines what the methods are called, along with what it returns, and its input parameters are.

MockModel.cs are where all the business logic of the projects is stored. In my case, I dependency injected the DB context into this file to have CRUD functionality with the database records.

Fin!

That’s all I have, for now, I will continue working on this project, and will release a part 2, for the Branches Controller and part 3 for the Subscribers Controller hopefully.

Check out my GitHub repository the code here: https://github.com/samsonnagamani/LMS

And it’s much appreciated for any constructive criticism and a clap.