Skip to content

Latest commit

 

History

History
56 lines (42 loc) · 1.6 KB

README.md

File metadata and controls

56 lines (42 loc) · 1.6 KB

📲 Multitier Architecture Xamarin Application

Contents

  1. Before we start
  2. IDEs and plugins used
  3. Architecture
  4. DB model

Before we start

IDEs and Frameworks used

IDEs and plugins:

  • Visual Studio 2019 Community Edition [ download ]
  • JetBrains Reshaper Ultimate [ download ]

Frameworks:

  • Entity Framework Core 6 (for SQLite)

Frameworks are available via NuGET Package Manager.

Architecture

Multitier architecture

Application is based on multitier architecture:

  • UI Layer
  • Service Layer
  • Business Layer
  • Data Access Layer

DB model

DB model

I used Entity Framework Core and Code First approach to create model as shown above. Here's my DbContext with OnConfiguring() method:

public ResDbContext()
{
    Batteries.Init();
    Database.EnsureCreated();
}

It's neccessary to use Batteries.Init() for EF Core.

protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
    var connectionStringBuilder = new SqliteConnectionStringBuilder { DataSource = "Researchers.db" };
    var connectionString = connectionStringBuilder.ToString();
    var connection = new SqliteConnection(connectionString);
    optionsBuilder.UseSqlite(connection);
}

Comparing to Entity Framework you don't have to modify config files for connection string so you basically just use OnConfiguring() method for it.