Skip to content

Getting started

Oyvind Ohra edited this page Jan 1, 2022 · 8 revisions

The course

Prerequisites for this course are:

  • course in object-oriented programming (or equivalent at university/university college level)
  • basic course in Java or C#
  • basic course in databases

On completion of the course, the students:

  • understand the structure of applications based on .NET
  • understand the structure of the key .NET libraries
  • understand the structure of C#
  • can develop relatively complicated .NET solutions in Visual Studio using C#
  • can evaluate alternative solution methods for a given problem
  • can learn about new aspects of .NET independently
  • understand the basic structure of new technologies developed for .NET

The course will also teach how to develop:

  • robust, maintainable and readable C# code
  • applications using a layered architecture
  • RESTful APIs

Solution architecture

The course will culminate with a solution that uses the following architecture:

A WinUI 3 desktop app communicating with one or more ASP.NET Web APIs, data stored in a remote SQL Server database, accessed through one or more APIs.

Getting started

Install the tools given in the Tools and technologies section.

Visual Studio

Check out this guide to get started using Visual Studio.

Database

Communication with the database will be done with the help of Entity Framework (EF) Core. This is a lightweight, extensible, open source and cross-platform version of the popular Entity Framework data access technology. EF Core can serve as an object-relational mapper (O/RM). The course will use EF Core 5 to support Windows Template Studio, this may change!

With EF Core, data access is performed using a model. A model is made up of entity classes and a context object that represents a session with the database. The context object allows querying and saving data.

Follow this tutorial to create a small app that performs data access against a SQLite database.

Change the database from SQLite (above) to use SQL Server (a mini SQL Server is installed with Visual Studio) by following this guide.

API

All communication from the app to the database will go through a RESTful API. Follow this tutorial to create a simple web API using ASP.NET Core.

WinUI 3 Desktop app

Follow this tutorial to create a small WinUI 3 desktop app. More samples you can play with can be found here.

App using Windows Template Studio

Windows Template Studio (WinTS) is a Visual Studio 2019 Extension that accelerates the creation of new desktop apps using a wizard-based experience.

Start Visual Studio and press File | New | Project, set the search filters as shown in the screen dump below, and select the project template App (WinUI 3 in Desktop).

Select project type Navigation Pane, and add a Settings and a ListDetails page, create the project. Press Debug | Start Debugging or F5, play with the app and the code 🧑‍🚀. A good introduction to the parts created by WTS can be found here.