Skip to content

Architecture

Poh Zhi-Ee edited this page Nov 3, 2018 · 15 revisions

This document serve to explain some stuff

IoC Container

The IoC container used in this project is AutoFac, selected due to ease of use, as well as good documentation and multiple examples of people using it on their Xamarin project.

To use an IoC container:

  1. Register types
  2. Specify lifetime
  3. Resolve

ViewModelLocator

The ViewModelLocator is to allow design time evaluation of the ViewModel while still allowing constructor injection of the ViewModel.

The ViewModelLocator will and should be called whenever a Page is created. This is done through binding the BindingContext of the Page to the appropriate ViewModel exposed by the ViewModelLocator. This will result in the creation of the appropriate ViewModel along with the Page.

The constructor injection is done through the use of the IoC Container.

Logging

The logging is done through the use of log4net, which is a highly popular library in .NET for logging.

Main advantages:

  1. Can specify logging levels
  2. Easily include timestamp of log
  3. Easily format log string
  4. Easily change logging medium, i.e. Console, Text file, etc.
  5. Simple to use

DTO

A DTO is basically a Data Transfer Object. Not to be confused with Model. These are basically dedicated for data transfer with the backend only, not to be used in anything else. Can refer to this,

Clone this wiki locally