MS Days 08 Applicazioni RIA con Silverlight 2 e WCF

Post on 05-Jul-2015

175 views 1 download

Transcript of MS Days 08 Applicazioni RIA con Silverlight 2 e WCF

1

bernabei@innovactive.it

maiorfi@innovactive.it

2

bernabei@innovactive.it

maiorfi@innovactive.it

3

bernabei@innovactive.it

maiorfi@innovactive.it

Ecco cosa ci dice Wikipedia:

Rich Internet Applications (RIAs) are web applications that

have the features and functionality of traditional desktop

applications. RIAs typically form a stateful client application

with a separate services layer on the backend.

RIAs typically do the following:

run in a web browser, or do not require software installation

run locally in a secure environment called a sandbox

4

bernabei@innovactive.it

maiorfi@innovactive.it

5

bernabei@innovactive.it

maiorfi@innovactive.it

6

bernabei@innovactive.it

maiorfi@innovactive.it

10 10 8 10

10 7 7 10

10 5 8 5

8 8 6 7

8 6 10 7

7

bernabei@innovactive.it

maiorfi@innovactive.it

Polimorfismo

Ereditarietà

Incapsulamento

Messaggi

Contratti+Schemi+Policy

Interoperabilità

Integrazione Binaria

Delocalizzazione

Metadati

Object-Oriented Service-OrientedComponent-Oriented

1980s 2000s1990s

8

bernabei@innovactive.it

maiorfi@innovactive.it

9

bernabei@innovactive.it

maiorfi@innovactive.it

Plug-in cross-browser e cross-platform

Runtime "managed" indipendente (subset di .NET 3.5)

Gira in una sua sandbox con isolated storage

Motore rendering vettoriale

Motore per le animazioni

10

bernabei@innovactive.it

maiorfi@innovactive.it

Separazione interfaccia/logica con XAML (dichiarativo)

Ricca libreria controlli inclusa

Interoperabilità con DOM e scripting della pagina “host”

Networking e supporto al "consumo" di servizi

Tanto altro (streaming, DLR, Deep Zoom, ecc.)

11

bernabei@innovactive.it

maiorfi@innovactive.it

Visual Studio 2008 (Tutte le versioni, Express compresa)

Silverlight 2 Tools for Visual Studio 2008

Silverlight 2 developer runtime (Windows)

VS Tools

VS Silverlight Project Templates

SDK documentation for integrated help

SDK (non-core) Controls (DataGrid, Date controls, Tab controls)

ASP.NET Server Controls (asp:Media and asp:Silverlight)

12

bernabei@innovactive.it

maiorfi@innovactive.it

Hello World Silverlight

13

bernabei@innovactive.it

maiorfi@innovactive.it

Expression Blend 2 SP1

Silverlight Toolkit (controlli MS su Codeplex)

XAML Power Toys

DeepZoom Composer

Eclipse Tools for Microsoft Silverlight

14

bernabei@innovactive.it

maiorfi@innovactive.it

1 Host a scelta tra: Windows Service, WinForms, Console Application, IIS, WAS (su Windows Vista® e Windows Server 2008®), “Dublin”

1 o più Tipi Concreti che implementano altrettanti Servizi

0 o più direttive che descrivono il “comportamento” del servizio

(Per ciascun tipo concreto) 1 o più Endpoint

15

bernabei@innovactive.it

maiorfi@innovactive.it

Definisce l’interfaccia di un servizio

”ABC” di un servizio WCFAddress – dove è esposto

Binding – come è esposto

Contract – cosa è esposto

Via codice o configurazione

Service

CBA

CBA

ABC

CBA

Message

16

bernabei@innovactive.it

maiorfi@innovactive.it

Hello World WCF

17

bernabei@innovactive.it

maiorfi@innovactive.it

Funziona solo conProfilo BasicHttpBinding (nessun supporto a WS-*)Sicurezza a livello di trasporto (SSL) e non di messaggioChiamate Cross-domain autorizzate dal chiamanteComunicazioni Asincrone

Ma supporta ancheAPI RESTSerializzazione/deserializzazione POX/JSONDataContractSerializer (serializza anche grafi con cicli)

18

bernabei@innovactive.it

maiorfi@innovactive.it

Ovvero: “Grazie, la richiamiamo noi…”

19

bernabei@innovactive.it

maiorfi@innovactive.it

Silverlight 2 + WCF

20

bernabei@innovactive.it

maiorfi@innovactive.it

E’ uno strumento che consente di implementare una

interfaccia REST per un Entity Data Model

REST è l’acronimo di Representational State Transfer

Un’interfaccia REST fornisce un URL per ogni risorsa

Utilizza i metodi http POST/GET/PUT/DELETE sulle risorse

Il miglior esempio di REST è il web!

API REST in delicious, flickr, google, ecc.

21

bernabei@innovactive.it

maiorfi@innovactive.it

Mappando le comuni operazioni di un Database abbiamo

CREATE = POST

READ = GET

UPDATE = PUT

DELETE = DELETE

PUT può essere

MERGE

PUT

22

bernabei@innovactive.it

maiorfi@innovactive.it

Una pagina web è la “rappresentazione” di una Risorsa

Forme di rappresentazione diverse per la stessa risorsa

HTML per un essere umano

XML per un software

ADO.NET Data Services (aka “Astoria”) rappresenta come

Javascript Object Notation (JSON)

Atom Pub

La scelta della rappresentazione avviene per mezzo di un header HTTP-Accept

23

bernabei@innovactive.it

maiorfi@innovactive.it

ADO.NET Data Services è basato su WCF

Un DataService è una classe che estende

DataService<T>

“T” può essere un ObjectContext, Un DataContext o

una classe custom

Un DataService espone le proprietà che

implementano IQueryable

Può esporre anche dei metodi custom

24

bernabei@innovactive.it

maiorfi@innovactive.it

Tutti i film del mondo

25 milioni di record

Attori, registi, scrittori, compositori

Trame, citazioni, errori, curiosità, edizioni, rating, ecc.

DB liberamente scaricabile in formato testuale

Importato in Microsoft SQL Server 2008

Client Silverlight per l’interrogazione con “Astoria”

25

bernabei@innovactive.it

maiorfi@innovactive.it

Applicazione IMDB

26

bernabei@innovactive.it

maiorfi@innovactive.it

Andrea Cruciani e Paolo Possanzini

Tutti gli sponsor

DotNetUmbria.org

Luca Paternoster (movie snippet)

Lo staff di IMDB

Innovactive (per il tempo rubato al lavoro)

Microsoft per il supporto all’evento

28

bernabei@innovactive.it

maiorfi@innovactive.it

© 2008 Microsoft Corporation. All rights reserved. Microsoft, Hyper-V, RemoteApp, Windows logo, Windows Start button, Windows Server Windows, Windows Vista and other product names are or may be

registered trademarks and/or trademarks in the U.S. and/or other countries. All other trademarks are property of their respective owners. The information herein is for informational purposes only and

represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the

part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR

STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.