net core, asp.net core e linux per il mobile

Post on 05-Apr-2017

88 Views

Category:

Software

1 Downloads

Preview:

Click to see full reader

TRANSCRIPT

.NET Core e Linux per il MobilePietro Libro

ROME 24-25 MARCH 2017

About me

• Senior Software Engineer• Systems Test Development• Project Leader for Factory 4.0 MES• http://www.gfms.com/country_CH/ 

LinkedIn: https://www.linkedin.com/in/pietrolibro/  Blog: http://blogs.ugidotnet.org/PietroLibroBlog  DomusDotNet: http://www.domusdotnet.org/  

Agenda

• .NET Core• .NET Core: Linux• ASP.NET Core• Deployment, 2 scenari

• Microsoft Azure App Service• Amazon Linux Virtual Machine

• Client: Xamarin Android• Question Time

.NET Core• Piattaforma Cross-Platform, gestita da Microsoft e Community

GitHub• Windows, Linux, macOS, IoT, embedded, cloud etc..• Q

• Distribuzione Flessibile• Riga di comando• Versione Cross-Platform del .NET Framework (al livello di BCL)• Fornisce subset di API disponibili in .NET Framework,

Xamarin/Mono  • Implementa le specifiche .NET Standard Library

• Open Source: Licenza MIT e APACHE 2, documentazione tramite CC-BY

• Supportato da Microsoft

.NET Core• Linguaggi supportati: C# e F#• Di base un singolo modello di applicazione «Console

Apps»(testo), su cui sono stati costruiti modelli aggiuntivi:• ASP.NET Core (parleremo oggi)• Piattaforma UWP (Universal Windows Platform) per Windows 10• Xamarin.Forms

• Composto da:• Microsoft .NET Core Runtime• Framework libraries• Microsoft .NET Core SDK Per iniziare• .NET «app host» -> .NET Core Apps • Altre versioni, pre-release: https://tinyurl.com/zd6lmla

• .NET Core Installation Guide: https://tinyurl.com/hurwe8f

• Per le Demo:• Sviluppo: .NET Core 1.1.1 con SDK 1.0.1 del 2017.03.07 (VS 2017)

.NET Core

.NET Core: Linux• Versioni minime supportate (https://tinyurl.com/hurwe8f):

• Red Hat Enterprise Linux 7 Server• Ubuntu 14.04, 16.04 e Linux Mint 17• Debian 8.x• Fedora 23• CentOS 7.1 & Oracle Linux 7.1• openSUSE 13.2

• Distribuzione demo: Debian 8.7.1 su Hyper-V• Download iso: https://tinyurl.com/26plvas

• Installazione e prima applicazione .NET Core in soli 3 steps!

ASP.NET Core

• Modello di applicazione Web-Oriented

• Composto da moduli con minimo overhead e massima flessibilità nella «costruzione» della propria applicazione• Astrazione tramite interface• Non piu’ basato su System.Web.dll• Basato su package NuGet da includere secondo le necessità

• Principali vantaggi:• Integrazione dei framework lato client (Grunt, Gulp, Knockout etc.)• HTTP (Request) pipeline leggera e modulare• Host in IIS o in un proprio processo• Built-in Dependency Injection• Unico path per Web UI (MVC) e Web APIs (RESTful applications)

• Per iniziare:• ASP.NET Core Getting Started: https://www.asp.net/core

Demo«.NET Core & ASP.NET Core App»

ASP.NET Core

• ASP.NET «Core App» è una «Console App» con Web Server nel «Main»

• Kestrel, cross-platform Web Server per ASP.NET Core basato su libuv • Libuv, cross-platform async I/O library: https://tinyurl.com/k2hdq7y• Possono essere utilizzati altri Web Server: https://tinyurl.com/hz6njyj

• «Startup» class• Configurazione Request Pipeline: Configure (Middleware)

• Static File• Authentication• Routing• …

• Configurazione Servizi: ConfigureServices (Dependeny Injection)• ASP.NET MVC Core• Entity Framework Core• Identity• …

ASP.NET Core: Pipeline

Middleware: https://tinyurl.com/zo79fty

Demo«CodeMotion2017 Blog Api»

DeploymentDue possibili scenari:• Continuous Deployment su Azure:

• Creazione Account su Azure (anche Trial)• Configurazione Azure Service App• Configurazione Git Repository• Configurazione Visual Studio Code• Docs: https://tinyurl.com/zbybrnk

• Deployment su Linux Virtual Machine (Ubuntu Server 14.04, Amazon)• Creazione Account su Amazon Web Service (anche Trial)• Configurazione Putty• Installazione .NET Core runtime• Configurazione HTTP Reverse Proxy (nginx)• Configurazione Filezilla (o script automatico)

Ambienti «confezionati» per la Demo per esigenze temporali

DemoPubblicazione su «Azure App Service» e «Amazon Linux Virtual Machine»

Client: Xamarin AndroidApplicazione Xamarin Android in Visual Studio 2017

Demo«CM Blog Api Client» (Xamarin Android Client)

Toolbox• Visual Studio Code

• Editor potente e flessibile eseguibile in ambiente Windows, macOS, Linux• Download: https://code.visualstudio.com/• Estensibile e Personalizzabile, GIT built-in, IntelliSense, Debugging

• Entity-Framework Core (O/RM)• Leggero, Estensibile Cross-Platform• MSSQL, SQLite, DB2, MySQL, SQL Server Compact, PostgreSQL, InMemory• Code First, DB-First• https://tinyurl.com/jcha2p6

• NGINX: HTTP e Reverse Proxy Server - https://nginx.org/en/

• Putty: SSH e TelNet client - http://www.putty.org/

• Filezilla: https://filezilla-project.org/

• Microsoft Azure: Piattaforma e Servizi di Cloud Computing• https://portal.azure.com • f

• Amazon Web Services: Piattaforma e Servizi di Cloud Computing• https://aws.amazon.com

Question Time

Entity Framework (EF) Core

Paragone con il «fratello maggiore»:https://docs.microsoft.com/en-us/ef/efcore-and-ef6/ Install-Package Microsoft.EntityFrameworkCore.SqliteAggiunta EF Tools per gestione databaseInstall-Package Microsoft.EntityFrameworkCore.Tools -Version 1.1.0-msbuild3-finalNella demo creiamo un DB partendo dal codiceE’ ovviamente anche possibile partire da un database esistente dal quale estrarre il modello:https://docs.microsoft.com/en-us/ef/core/get-started/aspnetcore/existing-db

Entity Framework (EF) CoreEF Core è un O/RMLeggeroEstensibileCross-platformSupporto a: MSSQL, SQLite, DB2, MySQL, SQL Server Compact, PostgreSQL, InMemory, MyCat…e customDocs ed esempi: https://docs.microsoft.com/en-us/ef/ Aggiunta EF Core per SQLite al progettoInstall-Package Microsoft.EntityFrameworkCore.SqliteAggiunta EF Tools per gestione databaseInstall-Package Microsoft.EntityFrameworkCore.Tools -Version 1.1.0-msbuild3-final

top related