SlideShare a Scribd company logo
OData e WCF Data Services:
  dati a portata di Web

           Pietro Libro
           Pietro.libro@domusdotnet.org
           http://blogs.ugidotnet.org/PietroLibroBlog
           Twitter: pietrolibro
Agenda
• Open Data Protocol (OData)
• WCF Data Services
   – QueryCRUD
   – Service Operations
   – Cache & Security




                               2
Problema…




            3
…soluzione: OData
•   Protocollo Web: interrogazione ed aggiornamento dati
•   Utilizza tecnologie Web: HTTP, AtomPub, JSON
•   Modello astratto dei dati: URI per identificare le risorse
•   Rilasciato sotto Microsoft Open Specification Promise




                                                                 4
OData
• Non solo database !




                        5
OData
• Feeds : collezione di Entries tipizzate
   – Una Entry è una struttura contente proprietà
       • Proprietà: tipi primitivi o tipi complessi
   – Una Entry può far parte di una struttura gerarchica o essere isolata
       • Relazione tra entry tramite Link
   – Entry sono speciali (Media Element)
       • Media Link Entry
       • Media Resource
• Service Operations
   – Funzioni che accettano parametri e restituiscono tipi complessi o
     primitivi



                                                                            6
OData
• Metadata:
   – Service Document con la lista di tutti i Feeds
      • Lista ad alto livello di tutti i Feeds
      • Utile per associare ogni Feed ad un indirizzo

  – Service Metadata Document
    • Documento che descrive l’Entity Data Model per uno
       specifico servizio
    • Esposto come End-point




                                                           7
OData : www.odata.org
• Alcune applicazioni «OData Publisher»:
   –   Microsoft Sharepoint 2010
   –   Microsoft Windows Azure Table Storage
   –   Sql Server Reporting Services
   –   OData per Team Foundation Server
   –   IBM WebShpere
• Librerie per interagire con:
   –   Microsoft .Net
   –   Windows Phone 7
   –   Microsoft Silverlight
   –   PHP
   –   Objective-C
   –   Ecc…

                                               8
DEMO
       9
WCF Data Services
• Conosciuti anche come ADO.NET Services (codename
  «Astoria»)
• Basati su
   – Open Data Protocol
   – REST (Representational State Transfer, Thomas Fielding)
      • Descrive le risorse presenti nel Web
      • Risorsa, univocamente determinata da un indirizzo
      • GET, POST, PUT e DELETE




                                                               10
11
WCF Data Services




                    12
WCF Data Services




DEMO

                    13
WCF Data Services
Anatomia di una query




                        14
WCF Data Services : Query
• Per applicare un «filtro» è possibile utilizzare la Keyword
  $filter
• Operatori di uguaglianza
• Confronto
• Operatori logici
• Operazioni matematiche
• Funzioni booleane applicabili a stringhe
• Funzioni per le date
• Funzioni di arrotondamento


                                                                15
WCF Data Services : Service Operations
• Logica di Business sui dati
• REST
• Requisiti
   – Public, membro di DataService<T>
   – Parametri di Input «Primitivi»
   – Il valore di ritorno può essere:
       •   Void
       •   IEnumerable
       •   IQueryable
       •   Un’entità (ad esempio Recipe, Glass)
       •   Tipo Primitivo



                                                  16
WCF Data Services : Service Operations
• Per operazioni di:
   – Filtering
   – Paging
   – Sorting
• Per utilizzare
   – Query Option
   – Accesso ai Link (entità collegate)
E’ necessario ritornare IQueryable<…>




                                          17
WCF Data Services : Service Operations
…ancora:




• WebGet [GET]
• WebInvoke(Method=«POST») [POST]




                                     18
WCF Data Services




Query, Service Operations, Eager & Explicit
Loading, Add/Update/Delete
DEMO
                                              19
WCF Data Services : Cache & Security
• Costruiti sull’infrastruttura ASP.NET
• Cache
   – Possiamo utilizzarne tutte le varie features
       •   Output caching
       •   Custom OutputCacheProvider
       •   Memory Cache
       •   Enterprise Library
       •   Ecc...




                                                    20
WCF Data Services : Cache & Security
• Costruiti sull’infrastruttura ASP.NET
• Security
   –   Query Interceptors
   –   Anonymous Authentication
   –   Basic-Digest Authentication
   –   Windows Authentication
   –   ASP.NET Forms Authentication
   –   Claims-Based Authentication
   –   WIF




                                          21
WCF Data Services




Cache & Security
DEMO
                    22
Riferimenti:
• OData, http://www.odata.org/
• OData Explorer:
  http://www.silverlight.net/content/samples/odataexplor
  er/default.html
• Microsoft OSP:
  http://www.microsoft.com/openspecifications/en/us/pr
  ograms/osp/default.aspx
• MSDN WCF Data Services: http://msdn.microsoft.com/it-
  it/library/cc668792.aspx
• Blog  : http://blogs.ugidotnet.org/PietroLibroBlog/


                                                       23
Un grazie a.....

More Related Content

PDF
Tile server
PPTX
Wcf data services
PDF
Architetture web - Linguaggi e standard - Web server, application server, dat...
PPTX
Web api 2.0
PPTX
Azure Logic Apps
PDF
SQL Server Data Virtualization with polybase
PPTX
ASP.NET Web API
PDF
Data flow
Tile server
Wcf data services
Architetture web - Linguaggi e standard - Web server, application server, dat...
Web api 2.0
Azure Logic Apps
SQL Server Data Virtualization with polybase
ASP.NET Web API
Data flow

Similar to WeWantWeb - WCF Data Services (20)

PPTX
Asp.net web api reloaded
PDF
Sviluppo di servizi REST per Android - Luca Masini
PDF
SVILUPPO DI SERVIZI REST PER ANDROID
PPTX
Win05 accesso ai dati in win 8
PPT
Dominopoint meet the experts 2015 - XPages
PDF
La nostra infrastruttura di produzione a container con Docker, Rancher e ZFS
PPTX
Le Applicazioni di Internet Web, FTP, Posta e App pr il Mobile
PPTX
SQL Server Benchmarking, Baselining and Workload Analysis
PDF
La nostra infrastruttura di produzione a container con Docker, Rancher e ZFS
PDF
REST API fantastiche e dove trovarle
PDF
Power BI: Introduzione ai dataflow e alla preparazione dei dati self-service
PPTX
Installing Apache tomcat with Netbeans
PDF
OCP Paas_ultima
PPTX
Design Patterns - enterprise patterns (part I)
PPTX
Polyglot Persistence e Big Data: tra innovazione e difficoltà su casi reali -...
PDF
Servizio di Connettività d'Ateneo - Network and services provisioning automation
PPTX
OCP-Architettura e caratteristiche della PaaS
PPTX
Mobile e Smart Client
PDF
Power bi
PPTX
ASP.NET MVC: Andare oltre il 100% (Web@work)
Asp.net web api reloaded
Sviluppo di servizi REST per Android - Luca Masini
SVILUPPO DI SERVIZI REST PER ANDROID
Win05 accesso ai dati in win 8
Dominopoint meet the experts 2015 - XPages
La nostra infrastruttura di produzione a container con Docker, Rancher e ZFS
Le Applicazioni di Internet Web, FTP, Posta e App pr il Mobile
SQL Server Benchmarking, Baselining and Workload Analysis
La nostra infrastruttura di produzione a container con Docker, Rancher e ZFS
REST API fantastiche e dove trovarle
Power BI: Introduzione ai dataflow e alla preparazione dei dati self-service
Installing Apache tomcat with Netbeans
OCP Paas_ultima
Design Patterns - enterprise patterns (part I)
Polyglot Persistence e Big Data: tra innovazione e difficoltà su casi reali -...
Servizio di Connettività d'Ateneo - Network and services provisioning automation
OCP-Architettura e caratteristiche della PaaS
Mobile e Smart Client
Power bi
ASP.NET MVC: Andare oltre il 100% (Web@work)
Ad

More from DomusDotNet (18)

PPTX
Application lifecycle management ... e quindi
PPTX
Unit testing in Visual Studio 2013
PPTX
Advanced ef code first 5.0 - EF@work
PPTX
ASP.NET MVC: sfruttare la piattaforma al 100%
PPTX
Push Notification, Live Tile e Background Agent
PDF
Sviluppare per Intel® Ultrabook™
PPTX
ALM@Work - Team collaboration with visual studio alm 2012
PPTX
ALM@Work - Lab management for everyone
PPTX
ALM@Work - Continuous delivery 101
PPTX
ALM@Work - Unit testing in Visual studio 2012
PPTX
ALM@Work - Typical developer day
PPTX
We Want Web - Web Applications con MVC 3
PPTX
ALM Revolutions - Non si vive di solo check-out e check-in
PPTX
ALM Revolutions - Process Template Customization
PPTX
ALM Revolutions - What's new in visual studio ALM 11
PDF
Pomeriggio Entity Framework - WP7 e SQL Compact Edition
PPTX
Pomeriggio Entity Framework - Database First
PPTX
Pomeriggio Entity Framework - Code First
Application lifecycle management ... e quindi
Unit testing in Visual Studio 2013
Advanced ef code first 5.0 - EF@work
ASP.NET MVC: sfruttare la piattaforma al 100%
Push Notification, Live Tile e Background Agent
Sviluppare per Intel® Ultrabook™
ALM@Work - Team collaboration with visual studio alm 2012
ALM@Work - Lab management for everyone
ALM@Work - Continuous delivery 101
ALM@Work - Unit testing in Visual studio 2012
ALM@Work - Typical developer day
We Want Web - Web Applications con MVC 3
ALM Revolutions - Non si vive di solo check-out e check-in
ALM Revolutions - Process Template Customization
ALM Revolutions - What's new in visual studio ALM 11
Pomeriggio Entity Framework - WP7 e SQL Compact Edition
Pomeriggio Entity Framework - Database First
Pomeriggio Entity Framework - Code First
Ad

WeWantWeb - WCF Data Services

  • 1. OData e WCF Data Services: dati a portata di Web Pietro Libro Pietro.libro@domusdotnet.org http://blogs.ugidotnet.org/PietroLibroBlog Twitter: pietrolibro
  • 2. Agenda • Open Data Protocol (OData) • WCF Data Services – QueryCRUD – Service Operations – Cache & Security 2
  • 4. …soluzione: OData • Protocollo Web: interrogazione ed aggiornamento dati • Utilizza tecnologie Web: HTTP, AtomPub, JSON • Modello astratto dei dati: URI per identificare le risorse • Rilasciato sotto Microsoft Open Specification Promise 4
  • 5. OData • Non solo database ! 5
  • 6. OData • Feeds : collezione di Entries tipizzate – Una Entry è una struttura contente proprietà • Proprietà: tipi primitivi o tipi complessi – Una Entry può far parte di una struttura gerarchica o essere isolata • Relazione tra entry tramite Link – Entry sono speciali (Media Element) • Media Link Entry • Media Resource • Service Operations – Funzioni che accettano parametri e restituiscono tipi complessi o primitivi 6
  • 7. OData • Metadata: – Service Document con la lista di tutti i Feeds • Lista ad alto livello di tutti i Feeds • Utile per associare ogni Feed ad un indirizzo – Service Metadata Document • Documento che descrive l’Entity Data Model per uno specifico servizio • Esposto come End-point 7
  • 8. OData : www.odata.org • Alcune applicazioni «OData Publisher»: – Microsoft Sharepoint 2010 – Microsoft Windows Azure Table Storage – Sql Server Reporting Services – OData per Team Foundation Server – IBM WebShpere • Librerie per interagire con: – Microsoft .Net – Windows Phone 7 – Microsoft Silverlight – PHP – Objective-C – Ecc… 8
  • 9. DEMO 9
  • 10. WCF Data Services • Conosciuti anche come ADO.NET Services (codename «Astoria») • Basati su – Open Data Protocol – REST (Representational State Transfer, Thomas Fielding) • Descrive le risorse presenti nel Web • Risorsa, univocamente determinata da un indirizzo • GET, POST, PUT e DELETE 10
  • 11. 11
  • 14. WCF Data Services Anatomia di una query 14
  • 15. WCF Data Services : Query • Per applicare un «filtro» è possibile utilizzare la Keyword $filter • Operatori di uguaglianza • Confronto • Operatori logici • Operazioni matematiche • Funzioni booleane applicabili a stringhe • Funzioni per le date • Funzioni di arrotondamento 15
  • 16. WCF Data Services : Service Operations • Logica di Business sui dati • REST • Requisiti – Public, membro di DataService<T> – Parametri di Input «Primitivi» – Il valore di ritorno può essere: • Void • IEnumerable • IQueryable • Un’entità (ad esempio Recipe, Glass) • Tipo Primitivo 16
  • 17. WCF Data Services : Service Operations • Per operazioni di: – Filtering – Paging – Sorting • Per utilizzare – Query Option – Accesso ai Link (entità collegate) E’ necessario ritornare IQueryable<…> 17
  • 18. WCF Data Services : Service Operations …ancora: • WebGet [GET] • WebInvoke(Method=«POST») [POST] 18
  • 19. WCF Data Services Query, Service Operations, Eager & Explicit Loading, Add/Update/Delete DEMO 19
  • 20. WCF Data Services : Cache & Security • Costruiti sull’infrastruttura ASP.NET • Cache – Possiamo utilizzarne tutte le varie features • Output caching • Custom OutputCacheProvider • Memory Cache • Enterprise Library • Ecc... 20
  • 21. WCF Data Services : Cache & Security • Costruiti sull’infrastruttura ASP.NET • Security – Query Interceptors – Anonymous Authentication – Basic-Digest Authentication – Windows Authentication – ASP.NET Forms Authentication – Claims-Based Authentication – WIF 21
  • 22. WCF Data Services Cache & Security DEMO 22
  • 23. Riferimenti: • OData, http://www.odata.org/ • OData Explorer: http://www.silverlight.net/content/samples/odataexplor er/default.html • Microsoft OSP: http://www.microsoft.com/openspecifications/en/us/pr ograms/osp/default.aspx • MSDN WCF Data Services: http://msdn.microsoft.com/it- it/library/cc668792.aspx • Blog  : http://blogs.ugidotnet.org/PietroLibroBlog/ 23