Die folgende Nachlese zur Open Data Protocol Webcast vom 25.11. gibt eine Übersicht zu dem OData Protokoll und zeigt die Schritte um eine SQL Azure Datenbank als Windows Communication Foundation (WCF) Data Service Dienst in OData zur Verfügung zu stellen.
Das Open Data Protocol (OData) ist ein REST-basiertes Web Protokoll für Daten Services. OData nutzt Web-Stack Technologien wie JSON und Atom über HTTP. Es bietet ähnliche Funktionen wie ODBC, ADO.NET und JDBC für CRUD (Create, Read, Update, Delete) Operationen. OData hat breite Library-Unterstützung mit den Windows .NET Communication Foundation (WCF) Data Services bis zu JavaScript.
Protokoll Stack
Der OData Stack besteht aus AtomPub oder JSON (JavaScript Object Notation) – JavaScript Serialisierungs Format, über HTTP(S) über TCP/IP.

Protokoll Spezifikation
Die
OData Spezifikation ist von Microsoft unter der Open Specification Promise veröffentlicht.
Protokoll Operationen Auszug
- Retrieve
- feeds, entries, service documents
- properties
- metadata document
- Create new Entries
- Update Entries
- Delete Entries
- Create/Remove/Replace Links zwischen Entries
Einstiegs Beispiel: Revisiting Northwind
Prereq: Auswahl von IE Disable Turn on feed reading view (IE: Internet Options – Content – Feed and Web Slice Settings)
Northwind DB als OData Feed über http://odata.org
Einfache human-readable Web Queries
Simple Queries über URL
Schema mit $metadata
Drill Down
Query mit Property
Query Option: Select nach Order Datum
Filter Expression
Query Options, Filter Method und Filter Expressions
- Query Option: z.B. $filter wie oben – Liste
- Filter Methods: z.B. startswith(), tolower() – Liste
- Filter Expressions z.B. Filter Method Call
Service Metadata
- Metadata in Conceptual Schema Definition File Format”
- Schema mit $metadata
Providers
Beispiel Providers
- NetFlix
- Ebay
- Northwind
- Windows Azure Table Storage
Windows Azure Marketplace DataMarket
Auszug an Basis Libraries
- Windows Communication Foundation (WCF)
- Astoria - alpha
- ADO.NET Data Services .NET 3.5 SP1 – v1
- Data Services Update .NET 3.5 SP1 – v2
- WCF Data Services ab .NET 4.0
- ASP.NET Ajax Toolkit
- datajs
OData in Windows aktuell
Aktuelle Version in W7 WCF: OData v2
WCF Oktober 2011 CTP mit OData v3
Breites OData Library Ecosystem
- Non-MS
- PHP, Java
- Microsoft Server
- in SQL Server 2008 R2
- Windows Azure Storage
- Excel 2010 (über PowerPivot)
- SharePoint 2010
WCF Data Services Toolkit
- WCF DS Erweiterung um aus verschiedensten Data Stores OData Feeds zu machen, z.B. CSV File
- Verwendung
- Override der RepositoryFor Methode
- Setzten von IQueryable Properties für alle Entities
Protokoll Overhead
- Bezogen auf Overhead - kein billiges Format
- Optimierungen
- WCF Databindings nur in Atom
Security
- Keine separaten OData Security Standards
- Security basiert von HTTP Security
- SSL, IPSec usw.
- Verwendung von z.B. HTTP Basic Authent, Windows Authentication
- Claims-based mit Access Token etc.
Tools
Open Data Protocol Visualizer in Visual Studio 2010:

Beispiel Erstellung eines WCF OData Dienstes
(1) Entity Data Model (EDM) Erstellung

Generierung aus existierendem DB Schema:

Data Source:

(2) EDM Graph in VS 2010

(3) WCF OData Dienst Erzeugung


(4) Fertiger OData Provider
http://localhost:15000/storedb.svc/ 
Links
Mailing List
Blogs
Twitter
Downloads
Slides (PDF)
WCF Oktober 2011 CTP mit OData v3
Disclaimer:
Allgemeine rechtliche Hinweise