Learn how to build real world nTier applications with the new Entity Framework and related services. This second part to the series will focus on using the Entity Framework in an nTier/ SOA world by separating out the different layers using T4 templates and using the new WCF Data Services to easily expose entity models via REST and to Silverlight clients.
3. Check Out Your Local User Groups! San Diego Cloud Computing User Group www.azureusergroup.com/group/sandiegoazureusergroup San Diego .NET Developers Group www.sddotnetdg.org San Diego .NET User Group www.sandiegodotnet.com San Diego SQL Server User Group www.sdsqlug.org
4. Win Free Software! Rules Provide your business card (or email and name)* Indicate on the back what software you are interested in Otherwise I will pick Winners will be picked next week *Yes, most likely I’m going to send you and email about my user group (sddotnetdg.org) and or web site (dotNetTips.com) Prizes CodeRush and Refactor Pro from DevExpress (4) SecondCopy (automatic backup software) (5) * CodeIt.Right Standard from SubMain (4) *Requires mailing address and phone number
7. User Experience Security Active Directory, Card Space, Windows Identity Foundation UI Components Windows Forms, Windows Presentation Foundation, ASP.NET (AJAX, MVC), Silverlight, Windows Mobile Presentation Layer Local Storage/ Cache Communications Layer Windows Communication Foundation (WCF), WCF Data Services, Web Services, Sync Services, Azure (Cloud), RIA Services, Workflow Services Business Layer Business Entities T4 Templates Business Components Business Workflow Windows Workflow Foundation Data Layer Entity Framework, LINQ to SQL, DataSets SQL Server
8. SOAP Issues Complex Slow Heavyweight Tied to development tools and libraries Not supported universally Cross-vendor/platform interoperability NOT perfect
9. REST == Architectural Stylefor connecting distributed applications Server-side resources identified by URI Access resources over HTTP/ HTTPS Returned data is “plain”: Atom, plain-XML or JSON
10. What is REST? Representational State Transfer An architectural style developed by Roy Fielding Resource based not RPC based Based on HTTP Standard resource formats Stateless communication between client and server GET, POST, PUT, DELETE Addressable resources + hyperlinking
11. XML XML JSON JSON How REST Works Client Server URL Resources VERB (GET, POST, PUT, DELETE) Resource 1 Representation Resource 2 Status Representation
12. What is OData? Protocol for sharing data via HTTP, AtomPub and JSON Open A way to break down data silos The ATOMPub and JSON format used by “Astoria” or WCF Data Services
13. Data Services Clients HTTP (Open Data Protocol) WCF Data Services SQL Server 2008 Reporting Services Windows Azure Table Storage
14. OData SDK – Client Library(March 2010) OData JavaScript Library OData SDK for PHP Restlet ext. for Java OData client lib for WP7 OData SDK for ObjC Data Services update for .NET 3.5 SP1 .NET 4.0 Silverlight 4.0
15. OData Consumers Modern web browsers OData explorer Excel 2010 – PowerPivot LINQPad Sesame
17. WCF Data Services Overview Framework from Microsoft that that facilitates the creation of RESTful data services via HTTP endpoints Shipped with .NET 3.5 SP1 Updates for 3.1 SP1 and .NET 4.0 Built on top of WCF4 Data representation in ATOM or JSON
18. WCF Data Services Overview Automates the exposure of data as RESTful resources Anything that implements IQueryable<T> and IUpdatable<T> Entity Framework 3rd party ORMs LINQ to SQL, custom data driven CLR classes Custom URI based querying
19. HTTP Open Data Protocol (OData) Hosting/HTTP Listener Data Services Runtime Data Access Layer Entity Framework Custom LINQ Provider Relational Database Other Sources
20. WCF 4 Programming Model Core Services Web HTTP Services Data Services RIA Services Workflow Services Service Model Data Contract Service Contract Service Behavior Channel Model Formats (Atom, JSON, XML,…) Transports (HTTP, TCP, …) Protocols (SOAP, HTTP, Open Data Protocol,…)
21.
22. Service Operations Additional way to expose resources via URIs [WebGet] is used for an addressable query [WebInvoke] is used for insert, update, and delete Can return a scalar value IEnumerable or IQueryable Astoria’s URI exposes the Service Operation If you use IQueryable you can append query strings to the URI
23.
24. Data Interceptors Query Interceptors Logic that will run when a resource is requested Can be used to limit the data viewed, log, or perform security check Change Interceptors Logic that will run when a change (Add/Edit/Delete) request is made
25.
26. Securing WCF Data Services Using the Host’s authentication model Role based authorization EntitySetRights Hiding Sensitive Data [IgnoreProperties] QueryInterceptors ServiceOperations to validate users Brute force: HTTPS, SSL, IP Filtering SQL Server Security should not be ignored either!
27. What’s New in .NET 4 Data Binding New DataServiceCollection class provides simplified binding of data service data to (WPF) controls. Includes auto updating. Counting Entities in an Set $count - total number of resources returned by a URI $inlinecount - total resource count together with the resource data Server-driven Paging Service can be configured to return requested resources as a set of paged responses
28. JSON/ XML HTTP/REST WCF Data Service DataServiceContext Data Binding HTTP/REST Entity Framework ObjectContext available ObjectContext not available Distributed system – WCF Data service SQL Server 2008
29. What’s New in .NET 4 Query Projections Query results can be modified to include only a subset of properties by using the new $select query option. Custom Data Service Providers Can implement a set of new data service provider interfaces, you can use various types of data with a data service, even when the data model changes during execution. Streaming of Binary Resources This enables you to retrieve and save binary large object data independent of the entity to which it belongs.
32. Resources WCF Data Services Learning Guide: http://msdn.microsoft.com/en-us/data/bb931106.aspx WCF Data Services Team Blog http://blogs.msdn.com/astoriateam
Goals:To show a new way of serving up dateGet you thinking to learn more when you leave this presentation
BrowsersMost modern browsers allow you to browse Atom based feeds. Simply point your browser at one of the OData producers.OData ExplorerA Silverlight application that can browse OData Services. It is available as part of the OData SDK Code Samples, and is available online at Silverlight.net/ODataExplorer.Excel 2010PowerPivot for Excel 2010 is a plugin to Excel 2010 that has OData support built-in.LINQPadLINQPad is a tool for building OData queries interactively.SesameA preview version of Fabrice Marguerie's OData Browser.Client LibrariesClient libraries are programming libraries that make it easy to consume OData services. We already have libraries that target:JavascriptPHPJavaWindows Phone 7 SeriesiPhone (Objective C).NET