MS Days 08 Applicazioni RIA con Silverlight 2 e WCF

27

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

Page 3: MS Days 08 Applicazioni RIA con Silverlight 2 e WCF

3

[email protected]

[email protected]

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

Page 6: MS Days 08 Applicazioni RIA con Silverlight 2 e WCF

6

[email protected]

[email protected]

10 10 8 10

10 7 7 10

10 5 8 5

8 8 6 7

8 6 10 7

Page 7: MS Days 08 Applicazioni RIA con Silverlight 2 e WCF

7

[email protected]

[email protected]

Polimorfismo

Ereditarietà

Incapsulamento

Messaggi

Contratti+Schemi+Policy

Interoperabilità

Integrazione Binaria

Delocalizzazione

Metadati

Object-Oriented Service-OrientedComponent-Oriented

1980s 2000s1990s

Page 9: MS Days 08 Applicazioni RIA con Silverlight 2 e WCF

9

[email protected]

[email protected]

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

Page 10: MS Days 08 Applicazioni RIA con Silverlight 2 e WCF

10

[email protected]

[email protected]

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.)

Page 11: MS Days 08 Applicazioni RIA con Silverlight 2 e WCF

11

[email protected]

[email protected]

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)

Page 12: MS Days 08 Applicazioni RIA con Silverlight 2 e WCF

12

[email protected]

[email protected]

Hello World Silverlight

Page 13: MS Days 08 Applicazioni RIA con Silverlight 2 e WCF

13

[email protected]

[email protected]

Expression Blend 2 SP1

Silverlight Toolkit (controlli MS su Codeplex)

XAML Power Toys

DeepZoom Composer

Eclipse Tools for Microsoft Silverlight

Page 14: MS Days 08 Applicazioni RIA con Silverlight 2 e WCF

14

[email protected]

[email protected]

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

Page 15: MS Days 08 Applicazioni RIA con Silverlight 2 e WCF

15

[email protected]

[email protected]

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

Page 16: MS Days 08 Applicazioni RIA con Silverlight 2 e WCF

16

[email protected]

[email protected]

Hello World WCF

Page 17: MS Days 08 Applicazioni RIA con Silverlight 2 e WCF

17

[email protected]

[email protected]

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)

Page 18: MS Days 08 Applicazioni RIA con Silverlight 2 e WCF

18

[email protected]

[email protected]

Ovvero: “Grazie, la richiamiamo noi…”

Page 19: MS Days 08 Applicazioni RIA con Silverlight 2 e WCF

19

[email protected]

[email protected]

Silverlight 2 + WCF

Page 20: MS Days 08 Applicazioni RIA con Silverlight 2 e WCF

20

[email protected]

[email protected]

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.

Page 21: MS Days 08 Applicazioni RIA con Silverlight 2 e WCF

21

[email protected]

[email protected]

Mappando le comuni operazioni di un Database abbiamo

CREATE = POST

READ = GET

UPDATE = PUT

DELETE = DELETE

PUT può essere

MERGE

PUT

Page 22: MS Days 08 Applicazioni RIA con Silverlight 2 e WCF

22

[email protected]

[email protected]

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

Page 23: MS Days 08 Applicazioni RIA con Silverlight 2 e WCF

23

[email protected]

[email protected]

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

Page 24: MS Days 08 Applicazioni RIA con Silverlight 2 e WCF

24

[email protected]

[email protected]

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”

Page 25: MS Days 08 Applicazioni RIA con Silverlight 2 e WCF

25

[email protected]

[email protected]

Applicazione IMDB

Page 26: MS Days 08 Applicazioni RIA con Silverlight 2 e WCF

26

[email protected]

[email protected]

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

Page 27: MS Days 08 Applicazioni RIA con Silverlight 2 e WCF

28

[email protected]

[email protected]

© 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.