Building nTier Applications with Entity Framework Services (Part 2)


Published on

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.

Published in: Technology
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide
  • 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 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
  • Demo: AdvertureWorksServiceDemo: AdventureWorks.Client
  • Demo: AdvertureWorksServiceDemo: AdventureWorks.Client
  • Demo: AdvertureWorksServiceDemo: AdventureWorks.Client
  • Demo: AdvertureWorksServiceDemo: AdventureWorks.Client
  • Building nTier Applications with Entity Framework Services (Part 2)

    1. 1. Building nTier Applications with Entity Framework ServicesPart 2<br />
    2. 2.
    3. 3. Check Out Your Local User Groups!<br />San Diego Cloud Computing User Group<br /><br />San Diego .NET Developers Group<br /><br />San Diego .NET User Group<br /><br />San Diego SQL Server User Group<br /><br />
    4. 4. Win Free Software!<br />Rules<br />Provide your business card (or email and name)*<br />Indicate on the back what software you are interested in<br />Otherwise I will pick <br />Winners will be picked next week<br />*Yes, most likely I’m going to send you and email about my user group ( and or web site (<br />Prizes<br />CodeRush and Refactor Pro from DevExpress (4)<br />SecondCopy (automatic backup software) (5) *<br />CodeIt.Right Standard from SubMain (4)<br />*Requires mailing address and phone number<br />
    5. 5. Agenda<br />
    6. 6. Exposing your Data over the wire (internet)<br />Service Layer<br />
    7. 7. User Experience<br />Security<br />Active Directory, Card Space, Windows Identity Foundation<br />UI Components<br />Windows Forms, Windows Presentation Foundation, ASP.NET (AJAX, MVC), Silverlight, Windows Mobile<br />Presentation Layer<br />Local Storage/ Cache<br />Communications Layer<br />Windows Communication Foundation (WCF), WCF Data Services, Web Services, Sync Services, Azure (Cloud), RIA Services, Workflow Services<br />Business Layer<br />Business Entities<br />T4 Templates<br />Business Components<br />Business Workflow<br />Windows Workflow Foundation<br />Data Layer<br />Entity Framework, LINQ to SQL, DataSets<br />SQL Server<br />
    8. 8. SOAP Issues<br />Complex<br />Slow<br />Heavyweight<br />Tied to development tools and libraries<br />Not supported universally<br />Cross-vendor/platform interoperability NOT perfect<br />
    9. 9. REST == Architectural Stylefor connecting distributed applications<br />Server-side resources identified by URI<br />Access resources over HTTP/ HTTPS<br />Returned data is “plain”: Atom, plain-XML or JSON<br />
    10. 10. What is REST?<br />Representational State Transfer<br />An architectural style developed by Roy Fielding<br />Resource based not RPC based<br />Based on HTTP<br />Standard resource formats<br />Stateless communication between client and server<br />GET, POST, PUT, DELETE<br />Addressable resources + hyperlinking<br />
    11. 11. XML<br />XML<br />JSON<br />JSON<br />How REST Works<br />Client<br />Server<br />URL<br />Resources<br />VERB <br />(GET, POST, PUT, DELETE)<br />Resource 1<br />Representation<br />Resource 2<br />Status<br />Representation<br />
    12. 12. What is OData?<br />Protocol for sharing data via HTTP, AtomPub and JSON<br />Open<br />A way to break down data silos <br />The ATOMPub and JSON format used by “Astoria” or WCF Data Services<br />
    13. 13. Data Services Clients<br />HTTP<br />(Open Data Protocol)<br />WCF Data Services<br />SQL Server 2008 Reporting Services<br />Windows Azure <br />Table Storage<br />
    14. 14. OData SDK – Client Library(March 2010)<br />OData JavaScript Library<br />OData SDK for PHP<br />Restlet ext. for Java<br />OData client lib for WP7<br />OData SDK for ObjC<br />Data Services update for .NET 3.5 SP1<br />.NET 4.0<br />Silverlight 4.0<br />
    15. 15. OData Consumers<br />Modern web browsers<br />OData explorer<br />Excel 2010 – PowerPivot<br />LINQPad<br />Sesame<br />
    16. 16. Easily Expose Your Entities<br />WCF Data Services & OData<br />
    17. 17. WCF Data Services Overview<br />Framework from Microsoft that that facilitates the creation of RESTful data services via HTTP endpoints<br />Shipped with .NET 3.5 SP1<br />Updates for 3.1 SP1 and .NET 4.0<br />Built on top of WCF4<br />Data representation in ATOM or JSON<br />
    18. 18. WCF Data Services Overview<br />Automates the exposure of data as RESTful resources<br />Anything that implements IQueryable<T> and IUpdatable<T><br />Entity Framework<br />3rd party ORMs<br />LINQ to SQL, custom data driven CLR classes<br />Custom URI based querying<br />
    19. 19. HTTP<br />Open Data Protocol (OData)<br />Hosting/HTTP Listener<br />Data Services Runtime<br />Data Access Layer<br />Entity<br />Framework<br />Custom LINQ Provider<br />Relational Database<br />Other Sources<br />
    20. 20. WCF 4<br />Programming Model<br />Core Services<br />Web HTTP Services<br />Data Services<br />RIA Services<br />Workflow Services<br />Service Model<br />Data Contract<br />Service Contract<br />Service Behavior<br />Channel Model<br />Formats<br />(Atom, JSON, XML,…)<br />Transports<br />(HTTP, TCP, …)<br />Protocols<br />(SOAP, HTTP, Open Data Protocol,…)<br />
    21. 21. URL Conventions<br />Addressing entities and sets<br /><ul><li>Presentation options</li></li></ul><li>
    22. 22. Service Operations<br />Additional way to expose resources via URIs<br />[WebGet] is used for an addressable query<br />[WebInvoke] is used for insert, update, and delete<br />Can return a scalar value<br />IEnumerable or IQueryable <br />Astoria’s URI exposes the Service Operation<br />If you use IQueryable you can append query strings to the URI <br />
    23. 23.
    24. 24. Data Interceptors<br />Query Interceptors<br />Logic that will run when a resource is requested<br />Can be used to limit the data viewed, log, or perform security check<br />Change Interceptors<br />Logic that will run when a change (Add/Edit/Delete) request is made<br />
    25. 25.
    26. 26. Securing WCF Data Services<br />Using the Host’s authentication model<br />Role based authorization<br />EntitySetRights<br />Hiding Sensitive Data<br />[IgnoreProperties]<br />QueryInterceptors<br />ServiceOperations to validate users<br />Brute force: HTTPS, SSL, IP Filtering<br />SQL Server Security should not be ignored either!<br />
    27. 27. What’s New in .NET 4<br />Data Binding<br />New DataServiceCollection class provides simplified binding of data service data to (WPF) controls. Includes auto updating.<br />Counting Entities in an Set <br />$count - total number of resources returned by a URI<br />$inlinecount - total resource count together with the resource data<br />Server-driven Paging <br />Service can be configured to return requested resources as a set of paged responses<br />
    28. 28. JSON/<br />XML<br />HTTP/REST<br />WCF Data Service<br />DataServiceContext<br />Data Binding<br />HTTP/REST<br />Entity Framework<br />ObjectContext available<br />ObjectContext not available<br />Distributed system – WCF Data service<br />SQL Server 2008<br />
    29. 29. What’s New in .NET 4<br />Query Projections<br />Query results can be modified to include only a subset of properties by using the new $select query option.<br />Custom Data Service Providers<br />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.<br />Streaming of Binary Resources<br />This enables you to retrieve and save binary large object data independent of the entity to which it belongs.<br />
    30. 30.
    31. 31. Summary<br />
    32. 32. Resources<br />WCF Data Services Learning Guide:<br /><br />WCF Data Services Team Blog<br /><br />
    33. 33. Required Book!<br />EF4 In Aug 2010<br />