SlideShare a Scribd company logo
1 of 40
Data Driven WPF and Silverlight Applications Dave Allen ISV Application Architect Developer and Platform Group Microsoft UK
Agenda Windows Presentation Foundation Silverlight Entity Framework WCF Data Services Silverlight & WCF Data Services Silverlight & WCF RIA Services
The Windows Client Platform Silverlight Mobile Mobile .NET XAML Desktop Web WPF Silverlight
Windows Presentation Foundation Now in it’s forth release: 3.0, 3.5, 3.5 SP1, 4.0 Highly stable platform for rich client applications Many bug fixes and supplemental features Performance optimizations – especially cold start-up Some mixed messages on it’s initial release WinForms is dead, no further development – not true! Backtrack – WPF isn’t really suitable for LOB – was true! Tooling not good enough for RAD of LOB apps – was true! WPF is moving into mainstream LOB WPF 4.0 primary goal is LOB applications WPF Toolkit still available  for supplemental features
Silverlight (subset of WPF) Now in it’s forth release: 1.0, 2.0, 3.0, 4.0 Platform for Rich Internet Applications (RIAs) Was originally a browser plug-in – still it’s primary use Cross-browser, cross-platforms, cross-device Includes .NET Runtime for C# and VB.NET Some key features From SL3 will now run out-of-browser Primary development platform for Windows Phone 7 Includes rich networking stack Integrates with HTML DOM Supports Isolated Storage Supports Safe File Open Dialog
The user experience
Primary features of WPF/Silverlight Vector based graphics, resolution-independent DPI  Composition engine – allows nesting of all controls Unified programming model for 2D, 3D, and Media Declarative programming model with XAML High degree of control over styling Powerful text engine and rendering  Support different types of layout Advanced animation techniques Built-in support for data binding Interop with COM components
WPF/Silverlight programming model XAML C# VB.NET <Button Width="100"> OK   <Button.Background>     LightBlue   </Button.Background> </Button> Button b1 = new Button(); b1.Content = "OK"; b1.Background = new SolidColorBrush(Colors.LightBlue); b1.Width = 100; Dim b1 As New Button b1.Content = "OK" b1.Background = New _    SolidColorBrush(Colors.LightBlue) b1.Width = 100 Declarative programming with XAML UI and code easy to separate 1:1 matching between XAML and code Easily toolable
Demo WPF applications
WPF/Silverlight UI components Controls Layout (Canvas, Border, StackPanel, Grid) Button, Calendar, Checkbox, Datagrid, DateTimePicker,  GridSplitter, HyperLink, Image, ListBox, MediaElement, MultiScaleImage, Popup, Radio, Slider, TextBox, TextBlock, Toggle, Tooltip, etc. User Control – aggregation of existing controls Styling Reuse of UI properties across multiple controls Templating Override the way a control displays itself Data templating for customization of how data is displayed Data Binding Allows binding of DataContext to a DataSource
Demo XAML and Silverlight anatomy
Silverlight behind the scenes Background processing on separate thread System.ComponentModel.BackgroundWorker Web Services SOAP 1.1 BP + Duplex, JSON, REST, RSS Sockets Only ports 4502-4534 are supported  Isolated Storage Per user, per application or per site/domain 1Mb quota is the default, can be changed File Open Dialog Allows user to choose file, access the file stream, upload
Demo Behind the scenes
Silverlight 3/4 Features Silverlight 3 60+ new controls added Data Forms Deep Linking Multi-page Application Element to Element binding Out of Browser  Silverlight 4 Printing support Rich text support 32 new languages + right to left support Elevated privileges and COM automation (OOB) Webcam/Mic support
WPF and Silverlight applications The paradigm shift WPF not a natural fit for a WinForms, VB6, MFC developer that has grown up on GDI/User32 XAML mark-up language more familiar to Web developers Visual Studio 2010 and Expression Blend generate XAML WPF/Silverlight/XBAP – too many options? Decision is much simpler than you think If you develop and deploy WinForms applications today WPF is the natural choice – full fidelity .NET If you develop WinForms applications and deployment is a problem, then XBAP could be the answer Restricted to browser sandbox – full fidelity .NET Also consider Out of Browser Silverlight If you target the browser today and are moving to RIA Silverlight is the natural next step
ADO.NET Entity Framework Another data access technology!?! Not designed to replace what has gone before Addresses the OOP versus Relational problem OOP very well established Relational have been around even longer Bridging the gap has mostly been a manual task Some 3rd party solutions, core problem remains Objects != Relational Data Fundamental problem is that relational data and objects in a programming language are NOT the same! They have different semantics, languages, etc. But both are still needed in most applications
ADO.NET Entity Framework Entity Data Model Models Entities and relationships between those Entities How does it bridge the gap between OOP and Relational Common type system Inheritance Complex types EDM is scoped to just modeling design of application data Entity Framework Provides services for consuming an EDM Object Services Entity Client (EntityConnection, EntityDataReader, etc.) Entity SQL LINQ To Entities Provider model for 3rd party databases
Entity Data Model Application model Mapped to a persistence store Comprised of three layers: Conceptual (CSDL) Mapping (MSL) Storage (SSDL) Database agnostic Not compiled Embed as a resource Store externally Entity Data Model Conceptual Mapping Storage
Demo Entity Data Model
Entity Framework EDM consumption options: Entity Client Entity SQL Object Services Entity SQL LINQ To Entities
Entity Framework – Service Stack LINQ To Entities Entity SQL Object Services Entity Client ADO.NET Provider
Entity Client Familiar ADO.NET object model: EntityCommand EntityConnection EntityDataReader Entity Parameter EntityTransaction Text-based results Read-only Uses Entity SQL
Entity SQL ,[object Object]
Targets conceptual model
Database agnosticT-SQL Entity SQL
Object Services Object materialized queries ObjectContext ObjectQuery<T> Built on top of Entity Client Two query options: Entity SQL LINQ Runtime services: Unit of work Identity tracking Eager/explicit loading
Entity Framework features Many to many relationships Join tables ignored by designer in EDM Side-effect, relationships cannot contain data LINQ supports this via the aggregate functions Inheritance Allows Entities to be specialized Maps to CLR inheritance Fully supported in queries 3 types of inheritance Table per type Table per hierarchy Table per concrete type
Entity Framework features (2) Entity splitting Single entity split across multiple tables, something you may do with very large tables Stored procedures Most asked question about EF Fully supported for CUD, map CUD functions to SPs Mainly supported for queries, but doesn’t support composable queries, dynamic SQL within SPs No metadata available at design-time Working against principles of EF Don’t use EF if you do this Consider using TVF instead of SPs
Entity Framework 4.0 new features Model-first development Automatic pluralization Foreign keys in models POCO class support Lazy loading T4 Code Generation Template customization IObjectSet Virtual SaveChanges ObjectStateManagercontrol Self-tracking entities SQL generation improvements More LINQ operator support LINQ extensibility ExecuteStoreQuery ExecuteStoreCommand SPROC import improvements Model defined functions WPF designer integration
Demo Entity Framework
Data Service over HTTP HTML + JavaScript DLL + XAML Mashup UI Data (XML, etc) Data (XML, etc) Data (XML, etc) Data Feeds AJAX Applications Silverlight Applications Online Services Mashups
Data Services today Web Service (ASMX, WCF) 1) GetCustomer(int id) 2) GetCustomers() 3) GetCustomers(string orderBy) 4) GetCustomers(string orderBy, string sortDirection) 5) GetCustomers(string orderBy, string sortDirection, int offset, int count) 6) GetCustomers(string orderBy, string sortDirection, int offset, int count, 		    string filter, string filterValue)
WCFData Services Data publishing service using a RESTful interface Just uses HTTP Therefore is able to use existing authentication mechanisms, and  other infrastructure components such as caching and proxies Uniform URL Syntax Every piece of information is addressable Predictable and flexible URL syntax Multiple representations ATOM JSON POX
WCFData Services (2) Exposes an object model (not a database) over the web Entity Data Model – WCFDS designed to work with EDM LINQ To SQL model, read-only Custom IQueryable<T> provider Operation semantics, mapping of HTTP verbs for CRUD operations GET – retrieve resource POST – create a resource PUT – update a resource DELETE – delete a resource
URL Conventions Addressing entities and sets Presentation options
Filters Logical operators and, or , asc, desc, eq, ne, true, false, gt, ge, lt, le, not, null Arithmetic operators add, sub, div, mul, mod String functions endswith, indexof, replace, startswith, tolower, toupper, trim, substring, substringof, concat, length Date functions year, month, day, hour, minute, second Math functions round, floor, ceiling Type functions Is, Cast
Demo WCFData Services
Securing and Customizing Data Services Visibility Control visibility per container Read, Query, and Write options Authentication Integrates with the hosting environment ASP.NET, WCF, or Custom authentication module Interceptors Execute before HTTP GET/PUT/POST/DELETE Enable validation, custom row-level security Maintain the REST interface Service operations Allow you to inject methods into URI if you need to
Clients Data Service
SilverlightClient Server Client Data Service Data Service Context HTTP Data Model Object Model

More Related Content

What's hot

Soprex framework on .net in action
Soprex framework on .net in actionSoprex framework on .net in action
Soprex framework on .net in actionMilan Vukoje
 
ILUG 2007 - Notes and Office Integration
ILUG 2007 - Notes and Office IntegrationILUG 2007 - Notes and Office Integration
ILUG 2007 - Notes and Office IntegrationJohn Head
 
Raj Wpf Controls
Raj Wpf ControlsRaj Wpf Controls
Raj Wpf Controlsrramabad
 
Dot Net Training Dot Net35
Dot Net Training Dot Net35Dot Net Training Dot Net35
Dot Net Training Dot Net35Subodh Pushpak
 
Dot Net Training Wcf Dot Net35
Dot Net Training Wcf Dot Net35Dot Net Training Wcf Dot Net35
Dot Net Training Wcf Dot Net35Subodh Pushpak
 
Introduction to the web
Introduction to the webIntroduction to the web
Introduction to the webSAMIR BHOGAYTA
 
Dotnet Basics Presentation
Dotnet Basics PresentationDotnet Basics Presentation
Dotnet Basics PresentationSudhakar Sharma
 
Net Framework Hima
Net Framework HimaNet Framework Hima
Net Framework HimaHimaVejella
 
Building configurable applications for the web
Building configurable applications for the webBuilding configurable applications for the web
Building configurable applications for the websupertom
 
Introducing the Entity Framework
Introducing the Entity FrameworkIntroducing the Entity Framework
Introducing the Entity FrameworkLearnNowOnline
 
MS Day EPITA 2010: Visual Studio 2010 et Framework .NET 4.0
MS Day EPITA 2010: Visual Studio 2010 et Framework .NET 4.0MS Day EPITA 2010: Visual Studio 2010 et Framework .NET 4.0
MS Day EPITA 2010: Visual Studio 2010 et Framework .NET 4.0Thomas Conté
 
Introduction to dot net framework by vaishali sahare [katkar]
Introduction to dot net framework by vaishali sahare [katkar]Introduction to dot net framework by vaishali sahare [katkar]
Introduction to dot net framework by vaishali sahare [katkar]vaishalisahare123
 
WPF For Beginners - Learn in 3 days
WPF For Beginners  - Learn in 3 daysWPF For Beginners  - Learn in 3 days
WPF For Beginners - Learn in 3 daysUdaya Kumar
 

What's hot (20)

Soprex framework on .net in action
Soprex framework on .net in actionSoprex framework on .net in action
Soprex framework on .net in action
 
ILUG 2007 - Notes and Office Integration
ILUG 2007 - Notes and Office IntegrationILUG 2007 - Notes and Office Integration
ILUG 2007 - Notes and Office Integration
 
Raj Wpf Controls
Raj Wpf ControlsRaj Wpf Controls
Raj Wpf Controls
 
Dot Net Training Dot Net35
Dot Net Training Dot Net35Dot Net Training Dot Net35
Dot Net Training Dot Net35
 
Silverlight Training
Silverlight TrainingSilverlight Training
Silverlight Training
 
Dot Net Training Wcf Dot Net35
Dot Net Training Wcf Dot Net35Dot Net Training Wcf Dot Net35
Dot Net Training Wcf Dot Net35
 
Introduction to the web
Introduction to the webIntroduction to the web
Introduction to the web
 
Dotnet Basics Presentation
Dotnet Basics PresentationDotnet Basics Presentation
Dotnet Basics Presentation
 
Net Framework Hima
Net Framework HimaNet Framework Hima
Net Framework Hima
 
Flex Rails Pres
Flex Rails PresFlex Rails Pres
Flex Rails Pres
 
Entity Framework 4
Entity Framework 4Entity Framework 4
Entity Framework 4
 
Building configurable applications for the web
Building configurable applications for the webBuilding configurable applications for the web
Building configurable applications for the web
 
Introducing the Entity Framework
Introducing the Entity FrameworkIntroducing the Entity Framework
Introducing the Entity Framework
 
Intro To AOP
Intro To AOPIntro To AOP
Intro To AOP
 
web services
web servicesweb services
web services
 
Flex for php developers
Flex for php developersFlex for php developers
Flex for php developers
 
MS Day EPITA 2010: Visual Studio 2010 et Framework .NET 4.0
MS Day EPITA 2010: Visual Studio 2010 et Framework .NET 4.0MS Day EPITA 2010: Visual Studio 2010 et Framework .NET 4.0
MS Day EPITA 2010: Visual Studio 2010 et Framework .NET 4.0
 
sidje
sidjesidje
sidje
 
Introduction to dot net framework by vaishali sahare [katkar]
Introduction to dot net framework by vaishali sahare [katkar]Introduction to dot net framework by vaishali sahare [katkar]
Introduction to dot net framework by vaishali sahare [katkar]
 
WPF For Beginners - Learn in 3 days
WPF For Beginners  - Learn in 3 daysWPF For Beginners  - Learn in 3 days
WPF For Beginners - Learn in 3 days
 

Similar to Data Driven WPF and Silverlight Applications

Visual Studio.NET
Visual Studio.NETVisual Studio.NET
Visual Studio.NETsalonityagi
 
Mike Taulty MIX10 Silverlight Frameworks and Patterns
Mike Taulty MIX10 Silverlight Frameworks and PatternsMike Taulty MIX10 Silverlight Frameworks and Patterns
Mike Taulty MIX10 Silverlight Frameworks and Patternsukdpe
 
MSDN Unleashed: WPF Demystified
MSDN Unleashed: WPF DemystifiedMSDN Unleashed: WPF Demystified
MSDN Unleashed: WPF DemystifiedDave Bost
 
Entity Framework Overview
Entity Framework OverviewEntity Framework Overview
Entity Framework Overviewukdpe
 
Top 10 Things in Visual Studio 2008 since 2005
Top 10 Things in Visual Studio 2008 since 2005Top 10 Things in Visual Studio 2008 since 2005
Top 10 Things in Visual Studio 2008 since 2005ukdpe
 
Daniel Egan Msdn Tech Days Oc Day2
Daniel Egan Msdn Tech Days Oc Day2Daniel Egan Msdn Tech Days Oc Day2
Daniel Egan Msdn Tech Days Oc Day2Daniel Egan
 
Overview of VS2010 and .NET 4.0
Overview of VS2010 and .NET 4.0Overview of VS2010 and .NET 4.0
Overview of VS2010 and .NET 4.0Bruce Johnson
 
Xml usage in my work
Xml usage in my workXml usage in my work
Xml usage in my workJoniKettunen
 
Silverlight Developer Introduction
Silverlight   Developer IntroductionSilverlight   Developer Introduction
Silverlight Developer IntroductionTomy Ismail
 
Unit - 1: ASP.NET Basic
Unit - 1:  ASP.NET BasicUnit - 1:  ASP.NET Basic
Unit - 1: ASP.NET BasicKALIDHASANR
 
Re-use Your Skills and Code to Expand the Reach of Your Apps with Silverlight
Re-use Your Skills and Code to Expand the Reach of Your Apps with SilverlightRe-use Your Skills and Code to Expand the Reach of Your Apps with Silverlight
Re-use Your Skills and Code to Expand the Reach of Your Apps with SilverlightFrank La Vigne
 
Silverlight
SilverlightSilverlight
Silverlightvishakpb
 
Tech Lunch 9 25 2008
Tech Lunch 9 25 2008Tech Lunch 9 25 2008
Tech Lunch 9 25 2008rothacr
 
Net framework
Net frameworkNet framework
Net frameworksumit1503
 
NET Event - Migrating WinForm
NET Event - Migrating WinFormNET Event - Migrating WinForm
NET Event - Migrating WinFormRaffaele Garofalo
 
Introduction To Wpf Engines
Introduction To Wpf   EnginesIntroduction To Wpf   Engines
Introduction To Wpf EnginesTamir Khason
 
Developing RIAs... 10 reasons to use Adobe Flex
Developing RIAs... 10 reasons to use Adobe FlexDeveloping RIAs... 10 reasons to use Adobe Flex
Developing RIAs... 10 reasons to use Adobe FlexMatthias Zeller
 

Similar to Data Driven WPF and Silverlight Applications (20)

Visual Studio.NET
Visual Studio.NETVisual Studio.NET
Visual Studio.NET
 
Mike Taulty MIX10 Silverlight Frameworks and Patterns
Mike Taulty MIX10 Silverlight Frameworks and PatternsMike Taulty MIX10 Silverlight Frameworks and Patterns
Mike Taulty MIX10 Silverlight Frameworks and Patterns
 
MSDN Unleashed: WPF Demystified
MSDN Unleashed: WPF DemystifiedMSDN Unleashed: WPF Demystified
MSDN Unleashed: WPF Demystified
 
Entity Framework Overview
Entity Framework OverviewEntity Framework Overview
Entity Framework Overview
 
Visual studio.net
Visual studio.netVisual studio.net
Visual studio.net
 
Top 10 Things in Visual Studio 2008 since 2005
Top 10 Things in Visual Studio 2008 since 2005Top 10 Things in Visual Studio 2008 since 2005
Top 10 Things in Visual Studio 2008 since 2005
 
Daniel Egan Msdn Tech Days Oc Day2
Daniel Egan Msdn Tech Days Oc Day2Daniel Egan Msdn Tech Days Oc Day2
Daniel Egan Msdn Tech Days Oc Day2
 
Overview of VS2010 and .NET 4.0
Overview of VS2010 and .NET 4.0Overview of VS2010 and .NET 4.0
Overview of VS2010 and .NET 4.0
 
soap toolkit
soap toolkitsoap toolkit
soap toolkit
 
Xml usage in my work
Xml usage in my workXml usage in my work
Xml usage in my work
 
Silverlight Developer Introduction
Silverlight   Developer IntroductionSilverlight   Developer Introduction
Silverlight Developer Introduction
 
Unit - 1: ASP.NET Basic
Unit - 1:  ASP.NET BasicUnit - 1:  ASP.NET Basic
Unit - 1: ASP.NET Basic
 
Re-use Your Skills and Code to Expand the Reach of Your Apps with Silverlight
Re-use Your Skills and Code to Expand the Reach of Your Apps with SilverlightRe-use Your Skills and Code to Expand the Reach of Your Apps with Silverlight
Re-use Your Skills and Code to Expand the Reach of Your Apps with Silverlight
 
Silverlight
SilverlightSilverlight
Silverlight
 
Tech Lunch 9 25 2008
Tech Lunch 9 25 2008Tech Lunch 9 25 2008
Tech Lunch 9 25 2008
 
Spsmi13 charts
Spsmi13 chartsSpsmi13 charts
Spsmi13 charts
 
Net framework
Net frameworkNet framework
Net framework
 
NET Event - Migrating WinForm
NET Event - Migrating WinFormNET Event - Migrating WinForm
NET Event - Migrating WinForm
 
Introduction To Wpf Engines
Introduction To Wpf   EnginesIntroduction To Wpf   Engines
Introduction To Wpf Engines
 
Developing RIAs... 10 reasons to use Adobe Flex
Developing RIAs... 10 reasons to use Adobe FlexDeveloping RIAs... 10 reasons to use Adobe Flex
Developing RIAs... 10 reasons to use Adobe Flex
 

More from Dave Allen

AppSense EM 8.5 Deep Dive
AppSense EM 8.5 Deep DiveAppSense EM 8.5 Deep Dive
AppSense EM 8.5 Deep DiveDave Allen
 
AppSense Environment Manager 8.5 Beta
AppSense Environment Manager 8.5 BetaAppSense Environment Manager 8.5 Beta
AppSense Environment Manager 8.5 BetaDave Allen
 
WPF & Silverlight UI
WPF & Silverlight UIWPF & Silverlight UI
WPF & Silverlight UIDave Allen
 
WPF & Silverlight Intro
WPF & Silverlight IntroWPF & Silverlight Intro
WPF & Silverlight IntroDave Allen
 
Silverlight 2.0
Silverlight 2.0Silverlight 2.0
Silverlight 2.0Dave Allen
 
ASP.NET 3.5 SP1
ASP.NET 3.5 SP1ASP.NET 3.5 SP1
ASP.NET 3.5 SP1Dave Allen
 

More from Dave Allen (6)

AppSense EM 8.5 Deep Dive
AppSense EM 8.5 Deep DiveAppSense EM 8.5 Deep Dive
AppSense EM 8.5 Deep Dive
 
AppSense Environment Manager 8.5 Beta
AppSense Environment Manager 8.5 BetaAppSense Environment Manager 8.5 Beta
AppSense Environment Manager 8.5 Beta
 
WPF & Silverlight UI
WPF & Silverlight UIWPF & Silverlight UI
WPF & Silverlight UI
 
WPF & Silverlight Intro
WPF & Silverlight IntroWPF & Silverlight Intro
WPF & Silverlight Intro
 
Silverlight 2.0
Silverlight 2.0Silverlight 2.0
Silverlight 2.0
 
ASP.NET 3.5 SP1
ASP.NET 3.5 SP1ASP.NET 3.5 SP1
ASP.NET 3.5 SP1
 

Recently uploaded

New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationKnoldus Inc.
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkPixlogix Infotech
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024TopCSSGallery
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Kaya Weers
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observabilityitnewsafrica
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Strongerpanagenda
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructureitnewsafrica
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesBernd Ruecker
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 

Recently uploaded (20)

New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App Framework
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architectures
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 

Data Driven WPF and Silverlight Applications

  • 1. Data Driven WPF and Silverlight Applications Dave Allen ISV Application Architect Developer and Platform Group Microsoft UK
  • 2. Agenda Windows Presentation Foundation Silverlight Entity Framework WCF Data Services Silverlight & WCF Data Services Silverlight & WCF RIA Services
  • 3. The Windows Client Platform Silverlight Mobile Mobile .NET XAML Desktop Web WPF Silverlight
  • 4. Windows Presentation Foundation Now in it’s forth release: 3.0, 3.5, 3.5 SP1, 4.0 Highly stable platform for rich client applications Many bug fixes and supplemental features Performance optimizations – especially cold start-up Some mixed messages on it’s initial release WinForms is dead, no further development – not true! Backtrack – WPF isn’t really suitable for LOB – was true! Tooling not good enough for RAD of LOB apps – was true! WPF is moving into mainstream LOB WPF 4.0 primary goal is LOB applications WPF Toolkit still available for supplemental features
  • 5. Silverlight (subset of WPF) Now in it’s forth release: 1.0, 2.0, 3.0, 4.0 Platform for Rich Internet Applications (RIAs) Was originally a browser plug-in – still it’s primary use Cross-browser, cross-platforms, cross-device Includes .NET Runtime for C# and VB.NET Some key features From SL3 will now run out-of-browser Primary development platform for Windows Phone 7 Includes rich networking stack Integrates with HTML DOM Supports Isolated Storage Supports Safe File Open Dialog
  • 7. Primary features of WPF/Silverlight Vector based graphics, resolution-independent DPI Composition engine – allows nesting of all controls Unified programming model for 2D, 3D, and Media Declarative programming model with XAML High degree of control over styling Powerful text engine and rendering Support different types of layout Advanced animation techniques Built-in support for data binding Interop with COM components
  • 8. WPF/Silverlight programming model XAML C# VB.NET <Button Width="100"> OK <Button.Background> LightBlue </Button.Background> </Button> Button b1 = new Button(); b1.Content = "OK"; b1.Background = new SolidColorBrush(Colors.LightBlue); b1.Width = 100; Dim b1 As New Button b1.Content = "OK" b1.Background = New _ SolidColorBrush(Colors.LightBlue) b1.Width = 100 Declarative programming with XAML UI and code easy to separate 1:1 matching between XAML and code Easily toolable
  • 10. WPF/Silverlight UI components Controls Layout (Canvas, Border, StackPanel, Grid) Button, Calendar, Checkbox, Datagrid, DateTimePicker, GridSplitter, HyperLink, Image, ListBox, MediaElement, MultiScaleImage, Popup, Radio, Slider, TextBox, TextBlock, Toggle, Tooltip, etc. User Control – aggregation of existing controls Styling Reuse of UI properties across multiple controls Templating Override the way a control displays itself Data templating for customization of how data is displayed Data Binding Allows binding of DataContext to a DataSource
  • 11. Demo XAML and Silverlight anatomy
  • 12. Silverlight behind the scenes Background processing on separate thread System.ComponentModel.BackgroundWorker Web Services SOAP 1.1 BP + Duplex, JSON, REST, RSS Sockets Only ports 4502-4534 are supported Isolated Storage Per user, per application or per site/domain 1Mb quota is the default, can be changed File Open Dialog Allows user to choose file, access the file stream, upload
  • 13. Demo Behind the scenes
  • 14. Silverlight 3/4 Features Silverlight 3 60+ new controls added Data Forms Deep Linking Multi-page Application Element to Element binding Out of Browser Silverlight 4 Printing support Rich text support 32 new languages + right to left support Elevated privileges and COM automation (OOB) Webcam/Mic support
  • 15. WPF and Silverlight applications The paradigm shift WPF not a natural fit for a WinForms, VB6, MFC developer that has grown up on GDI/User32 XAML mark-up language more familiar to Web developers Visual Studio 2010 and Expression Blend generate XAML WPF/Silverlight/XBAP – too many options? Decision is much simpler than you think If you develop and deploy WinForms applications today WPF is the natural choice – full fidelity .NET If you develop WinForms applications and deployment is a problem, then XBAP could be the answer Restricted to browser sandbox – full fidelity .NET Also consider Out of Browser Silverlight If you target the browser today and are moving to RIA Silverlight is the natural next step
  • 16. ADO.NET Entity Framework Another data access technology!?! Not designed to replace what has gone before Addresses the OOP versus Relational problem OOP very well established Relational have been around even longer Bridging the gap has mostly been a manual task Some 3rd party solutions, core problem remains Objects != Relational Data Fundamental problem is that relational data and objects in a programming language are NOT the same! They have different semantics, languages, etc. But both are still needed in most applications
  • 17. ADO.NET Entity Framework Entity Data Model Models Entities and relationships between those Entities How does it bridge the gap between OOP and Relational Common type system Inheritance Complex types EDM is scoped to just modeling design of application data Entity Framework Provides services for consuming an EDM Object Services Entity Client (EntityConnection, EntityDataReader, etc.) Entity SQL LINQ To Entities Provider model for 3rd party databases
  • 18. Entity Data Model Application model Mapped to a persistence store Comprised of three layers: Conceptual (CSDL) Mapping (MSL) Storage (SSDL) Database agnostic Not compiled Embed as a resource Store externally Entity Data Model Conceptual Mapping Storage
  • 20. Entity Framework EDM consumption options: Entity Client Entity SQL Object Services Entity SQL LINQ To Entities
  • 21. Entity Framework – Service Stack LINQ To Entities Entity SQL Object Services Entity Client ADO.NET Provider
  • 22. Entity Client Familiar ADO.NET object model: EntityCommand EntityConnection EntityDataReader Entity Parameter EntityTransaction Text-based results Read-only Uses Entity SQL
  • 23.
  • 26. Object Services Object materialized queries ObjectContext ObjectQuery<T> Built on top of Entity Client Two query options: Entity SQL LINQ Runtime services: Unit of work Identity tracking Eager/explicit loading
  • 27. Entity Framework features Many to many relationships Join tables ignored by designer in EDM Side-effect, relationships cannot contain data LINQ supports this via the aggregate functions Inheritance Allows Entities to be specialized Maps to CLR inheritance Fully supported in queries 3 types of inheritance Table per type Table per hierarchy Table per concrete type
  • 28. Entity Framework features (2) Entity splitting Single entity split across multiple tables, something you may do with very large tables Stored procedures Most asked question about EF Fully supported for CUD, map CUD functions to SPs Mainly supported for queries, but doesn’t support composable queries, dynamic SQL within SPs No metadata available at design-time Working against principles of EF Don’t use EF if you do this Consider using TVF instead of SPs
  • 29. Entity Framework 4.0 new features Model-first development Automatic pluralization Foreign keys in models POCO class support Lazy loading T4 Code Generation Template customization IObjectSet Virtual SaveChanges ObjectStateManagercontrol Self-tracking entities SQL generation improvements More LINQ operator support LINQ extensibility ExecuteStoreQuery ExecuteStoreCommand SPROC import improvements Model defined functions WPF designer integration
  • 31. Data Service over HTTP HTML + JavaScript DLL + XAML Mashup UI Data (XML, etc) Data (XML, etc) Data (XML, etc) Data Feeds AJAX Applications Silverlight Applications Online Services Mashups
  • 32. Data Services today Web Service (ASMX, WCF) 1) GetCustomer(int id) 2) GetCustomers() 3) GetCustomers(string orderBy) 4) GetCustomers(string orderBy, string sortDirection) 5) GetCustomers(string orderBy, string sortDirection, int offset, int count) 6) GetCustomers(string orderBy, string sortDirection, int offset, int count, string filter, string filterValue)
  • 33. WCFData Services Data publishing service using a RESTful interface Just uses HTTP Therefore is able to use existing authentication mechanisms, and other infrastructure components such as caching and proxies Uniform URL Syntax Every piece of information is addressable Predictable and flexible URL syntax Multiple representations ATOM JSON POX
  • 34. WCFData Services (2) Exposes an object model (not a database) over the web Entity Data Model – WCFDS designed to work with EDM LINQ To SQL model, read-only Custom IQueryable<T> provider Operation semantics, mapping of HTTP verbs for CRUD operations GET – retrieve resource POST – create a resource PUT – update a resource DELETE – delete a resource
  • 35. URL Conventions Addressing entities and sets Presentation options
  • 36. Filters Logical operators and, or , asc, desc, eq, ne, true, false, gt, ge, lt, le, not, null Arithmetic operators add, sub, div, mul, mod String functions endswith, indexof, replace, startswith, tolower, toupper, trim, substring, substringof, concat, length Date functions year, month, day, hour, minute, second Math functions round, floor, ceiling Type functions Is, Cast
  • 38. Securing and Customizing Data Services Visibility Control visibility per container Read, Query, and Write options Authentication Integrates with the hosting environment ASP.NET, WCF, or Custom authentication module Interceptors Execute before HTTP GET/PUT/POST/DELETE Enable validation, custom row-level security Maintain the REST interface Service operations Allow you to inject methods into URI if you need to
  • 40. SilverlightClient Server Client Data Service Data Service Context HTTP Data Model Object Model
  • 41. Demo Silverlight WCF Data Services Client

Editor's Notes

  1. Things have got much better in terms of user interaction in other walks of life since the GUI was brought to us on Windows and the MAC, but although things have improved since Windows 3.0, in some ways nothing has changed since 1980sUser experience is more than “looks”. User experience represents the overall interaction process of the user with an object. This interaction provides the user with an added value benefit. In this case the benefit that both tools offer is “opening a can”. However it is evident that the can opener will provide the user with a better overall user experience on obtaining the benefit. It is more secure, easier to use and can achieve the benefit faster than the knife.Let’s take this example even further. What is the difference between 2 cars - a 10K car and a 40K BMW? Both take you from point A to point B. There’s a world of difference. For one, the BMW has a much superior user experience (styling, handling, performance, etc.) In addition, notice that a BMW offers its owners an emotional connection, a “pride of ownership.” This gives BMW a unique brand in the eyes of its owners, and to the millions of potential owners who dream of buying this car some day! This shows us that user experience has tremendous business value – ability to differentiate products, create brand awareness, and customer satisfaction.
  2. Stands for EXtensiveApplication Markup LanguageEasily toolable, declarative markupBuild applications in simple declarative statementsCan be used for any CLR object hierarchyCode and content are separateStreamline collaboration between designers and developersDevelopers add business logic, while designers design Can be rendered in the browser (as part of a web page) or as a standalone application
  3. Family Show http://www.vertigo.com/familyshow.aspxBritish Library http://ttpdownload.bl.uk/app_files/xbap/BrowserApp.xbap
  4. XAML DemosSilverlight anatomyHTMLobject tagASP.NET FileXAP file
  5. Silverlight Background projectSilverlight LocalInteraction project
  6. Talking Points: When we talk about the Entity Framework, we’re actually talking about two things: The Entity Data Model (EDM) The Entity Framework It’s important to delineate the two as separate, but complementing technologies The Entity Framework is a set of services that allow you to consume an EDM from within your applications. Object services is a set of classes that allow you to query an EDM and retrieve your results in the form of strongly-typed CLR objects. Entity Client allows you to query an EDM using a traditional ADO.NET paradigm (EntityConnection, EntityDataReader, etc.) Provides a smooth migration path for developers that are new to the Entity Framework Offers performances benefits due to the lack of object materialization Entity SQL is a SQL-like language that let’s you query your EDM with full control. Unlike SQL, Entity SQL queries the conceptual model, so your queries can be expressed in terms of the way your application sees your model, not how your database is actually shaped. LINQ To Entities sits on top of Object Services and allows you to retrieve strongly-typed objects from your EDM, expressed through familiar LINQ query syntax.The Entity Framework is RDMS agnostic, and numerous database vendors are currently developing providers: Oracle, DB2, MySQL, PostgreSQL, VistaDB, SQLite, Sybase, Informix, etc.
  7. Estimated Time: 6 minutesTalking Points: When we talk about the Entity Framework, we’re actually talking about two things: The Entity Data Model (EDM) The Entity Framework It’s important to delineate the two as separate, but complementing technologies The EDM is a set of layers that make up your application’s model, as well as it’s mapping to an underlying data store. Made up of three files: CSDL (Conceptual Schema Definition Language) MSL (Mapping Specification Language) SSDL (Storage Schema Definition Language) This separation of concerns allows great flexibility: Model your application the way you want regardless of the state/structure of its underlying data store Normalize your database as much as you need without worrying about affecting the interface of the application’s object model The EDM represents a re-useable application model that can be leveraged from within many applications/environments and persisted across numerous databases. The Entity Data Model is RDMS agnostic, and numerous database vendors are currently developing providers: Oracle, DB2, MySQL, PostgreSQL, VistaDB, SQLite, Sybase, Informix, etc. The Entity Data Model primarily of three main concepts: Entities, which represent your domain objects. Associations, which represent a relationship between two entities. Functions, which represent stored procedures or UDFs in your database that can be mapped to model-level functionality. Because there will be plenty of situations where you’ll need to use stored procedures, the Entity Data Model allows you to map functions in your model to a store procedure in your database. This is useful because you can leverage a stored procedure without having to write ADO.NET code to call it, you can simply call a function on your model. EDM functions are represented as methods on your ObjectContext class.
  8. EFConsoleDemoTO DO:Add EDM for Adventure Works Product and SalesOrderDetailLook inside EDM to show: CSDL (Conceptual Schema Definition Language) MSL (Mapping Specification Language) SSDL (Storage Schema Definition Language)
  9. Estimated Time: 1 minuteTalking Points: Now that we’ve seen the Entity Data Model, let’s see how to work with it using the Entity Framework. The Entity Framework is a set of services that allow you to consume an EDM from within your applications:Entity Client Entity SQL Object Services Entity SQL LINQ To Entities We’ll take a look at the 3 different flavors on consumption in detail, and discuss why and when you would use each one.
  10. Estimated Time: 3 minutesTalking Points: This diagram helps to illustrate how each of the Entity Framework’s query options relate to each other. At the core of it all is the database-specific provider. This layer is what translates the query into the SQL flavor required for the underlying data source. Above that is the Entity Client API, which takes the Entity Framework query and passes in down to the database specific provider. If you want to use the Entity Client API directly, you see that you’re only query option is Entity SQL, and because it sits below Object Services, you don’t get any of its benefits. If you want to materialize your queries as objects, and get things like change tracking, identity mapping, relationship loading, etc. then you would use object services, that delegates its queries down to the Entity Client layer. When using Object Services you can leverage both Entity SQL and LINQ to make your queries.
  11. Estimated Time: 4 minutesTalking Points: The Entity Client is an Entity Framework “port” of the familiar object model of classes used in traditional ADO.NET programming, including:EntityCommandEntityConnectionEntityConnectionStringBuilderEntityDataReaderEntityParameterEntityTransaction Because of this fact it makes it a prime choice for developers migrating to the Entity Framework from ADO.NET. Just like traditional ADO.NET, your queries are returned as sequential text-based data that can iterated over using an EntityDataReader. This is great for performance, but lacks the rich object model that was created as part of your EDM. Entity Client gives you read-only access to your EDM. If data modification is required, you’ll have to use Object Services, which we’ll talk about in a bit. When using Entity Client, your queries are written using Entity SQL, which we’ll talk about in the next slide.
  12. Estimated Time: 4 minutesTalking Points: Entity SQL is a query language that is syntactically very similar to SQL, but serves the sole-purpose of querying an EDM. Because it is meant for querying your EDM, this means your queries are written against your conceptual model, not your underlying data store. This higher-level abstraction allows you to write a textual query that is database agnostic. The translation from Entity SQL to T-SQL or PL/SQL (or whatever flavor your underlying data uses), is done by the selected ADO.NET Provider. Here we see a simple example that shows the same query written in T-SQL as well as Entity SQL. Notice that in Entity SQL we don’t have to do any joins, because the notion of relationships are first-class in our conceptual model. As a result, our query is half the size as the T-SQL version. Notice the use of the “Length” function in our Entity SQL example. This is called a “Canonical Function”, which is a high-level abstraction of a database function that will be translated into it’s respective database-specific flavor by your underlying provider
  13. Estimated Time: 5 minutesTalking Points: While the Entity Client API is great and performant, it lacks the use of our created object model, as well as the ability to update data in our model. The Object Services API sits on top of Entity Client, and provides object materialization on top of our queries. This means that instead of getting text-based results, we get back a collection of CLR objects that we can easily work with. The two mains components of the Object Services taxonomy are: ObjectContext, and ObjectQuery&lt;T&gt;ObjectContext is equivalent to an EntityConnection, and is what manages our connection to the EDM as well as provides crucial services for working with our data.ObjectQuery is equivalent to an EntityCommand and represents a single query executed against our EDM, that is manifested back as strongly-typed objects. Object Services allows you to write queries using two flavors: Entity SQL LINQ To Entities The same Entity SQL queries you would write using Entity Client can be leveraged with Object Services, but with the added benefits you get with the higher abstraction level (i.e. object materialization). While Entity SQL is great for scenarios that require a dynamic query, or greater control over your query’s shape, you’re still working with a string that is error-prone. In addition to Entity SQL, Object Services allows you to write your queries against it in LINQ which provides you with strong-typing, error-checking, and a higher level of abstraction from Entity SQL. If you are already familiar with LINQ, then you don’t have to master Entity SQL in order to query an EDM, because LINQ To Entities will make the translation for you. In addition to object materialization, object services provides you with other benefits/services: Unit of work Your Object Context represents your unit of work, which aggregates all changes made to all entities attached/contained in it, so that when you want to push those changes back to the server, you can do so in a single batch. Identity tracking The ObjectContext keeps track of the entities you’ve queried for by key, so that if you later request the same entity (by key), using the same ObjectContext instance, it will return you the instance it already has instead of re-hitting the database. Eager/explicit loading The Entity Framework doesn’t pre-load any relationship properties for you. If you want to query an entity as well as some of it’s related entities, you’ll need to explicitly request that by performing a “span” using the Include method of the ObjectQuery&lt;T&gt; class. Alternatively you can call the Load method on your entity’s relationship property.
  14. Table per type – classic inheritance where separate table contains additional propertiesTable per hierarchy – many types contained in one table and used an indicator flag to indicate the type, table may contain null columns when they have no relevance to type. Situation may occur when table had been de-normalized. Can create many sub-types based on table.Table per concrete type – all information for sub-type in a separate table, e.g. discontinued product information used for reference
  15. EFConsoleDemoTO DO:Create 1 to Many Association between Product and SalesOrderDetail on ProductIDDemo code inside EFConsoleDemo
  16. Estimated Time: 4 minutesTalking Points: Let’s briefly take a look at some common scenarios that services apply. If you develop an AJAX application, the client requests a page and the server returns HTML and JavaScript. At that point all communication happens between the client (JavaScript) and the server. This situation will typically call for a set of services on the server that the client can call using AJAX. In this scenario, the service required for client-server communication is largely data centric, and could look similar to the example we saw in the previous slide [Advance Animation] In a Silverlight application, the server returns the compiled Silverlight app, which then runs on the client’s machine. At that point any client-server communication is done with services. A lot of the services required by the client might be data-centric, at which point we’re in the same situation as we saw in the previous slide [Advance Animation] If you’re creating an online service that is meant to provide data over the cloud, then you’re creating nothing but data access logic, so we’re looking at the same scenario as before [Advance Animation] Finally if you’re creating a mashup, your server returns the UI of the mashup itself, which in turn contains logic for communicating with the data feeds that you’re mashing up. There are many other scenarios that require the use of services, but these exemplify enough the need for services that are largely data-centric. Keep in mind, that there are plenty of scenarios where service functionality that is operational in nature and not data-centric, is also typically required. But in many cases in these scenarios, the common need is data.
  17. Estimated Time: 4 minutesTalking Points: Today is we wanted to make a web service using the .NET stack, we could use ASMX or WCF. Both options are great and provide there own level of flexibility and ease-of-use, based on your own familiarity. Imagine we create a service, and initially our service’s purpose is to return a specific customer from a data store [Advance Animation] We simply create a GetCustomer method on our service, and we’re good to go. We later realize that we need to be able to retrieve a list of all customers as well [Advance Animation] We add a GetCustomers method that retrieves all customers, easy enough. We realize that we’ll also have a need to retrieve customers, sorted by a specific field [Advance Animation] We add an overloaded version of GetCustomers that takes an order column. While our service’s functionality is increasing, so is its size. Now we realize that we need to be able to specify the sort direction of the ordered customers we retrieve [Advance Animation] Yet another overloaded version of our GetCustomers method is created. While being able to retrieve all customers is great, the amount of data being transported is too much, so we need to implement a paging mechanism [Advance Animation] Great, now we have paging, and another GetCustomers overloaded. Then we realize we need to be able to apply an arbitrary filter criteria to the method, so we add yet another overload [Advance Animation] So now we have created six methods on our service just to retrieve customer data with ordering, paging, and filtering. What if we later needed address data, and orders made by customers, etc. The amount of code needed to write data access code grows exponentially. Even further, we have only discussed the read operations. What if we later need to have insert, update, and delete methods for customers on our service? Yet more methods added, and more boilerplate code written.
  18. Representational State Transfer (REST) is an architectural pattern used in the design of services. REST is about the way in which you expose and make available to callers the contract of the service. REST, therefore, is opposed to SOAP. WCF Data Services’ RESTful interface uses a common URL syntax that clients can learn and leverage across all data services This makes it easy to consume new data services once you’re familiar with the syntax
  19. It’s important to note that the “Data” in “Data Services” isn’t referring to a database. A data service is meant to expose data, of any kind over the web, in a standard, and easily consumable fashion. A data service is capable of exposing any object model that contains public properties of type IQueryable&lt;T&gt;. This criteria matches LINQ To SQL, and the Entity Framework, but can just as easily fit a custom object model. Data services implements the Atom Publishing Protocol (AtomPub or APP): Maps HTTP verbs to CRUD operations: GET = Read POST = Create PUT = UpdateDELETE = Delete Exposes the data in the form of Atom feeds and entries
  20. http://localhost/WCFDataServices/Service.svc/$metadatahttp://localhost/WCFDataServices/Service.svc/Productshttp://localhost/WCFDataServices/Service.svc/Product(324)http://localhost/WCFDataServices/Service.svc/Product(324)/Namehttp://localhost/WCFDataServices/Service.svc/Product(324)/Name/$valuehttp://localhost/WCFDataServices/Service.svc/ProductSubcategories(2)/Productshttp://localhost/WCFDataServices/Service.svc/ProductSubcategories(2)/Products(789)/Namehttp://localhost/WCFDataServices/Service.svc/Products?$orderby=Namehttp://localhost/WCFDataServices/Service.svc/Products?$filter=Color%20eq%20&apos;Black’http://localhost/WCFDataServices/Service.svc/Products?$top=2http://localhost/WCFDataServices/Service.svc/Products?$top=2&amp;$skip=2http://localhost/WCFDataServices/Service.svc/ProductSubcategories?$expand=Products
  21. Estimated Time: 2 minutesTalking Points: While working with a data service in a browser is great, that doesn’t exactly help accent a client application very much. Because data services have a RESTful interface, you could program against use them using any HTTP stack, such as the HttpWebRequest class in .NET.HttpWebRequest doesn’t offer the rich data platform client functionality that developers might expect, which is why ADO.NET Data Services provides a set of client APIs for working with data services in a more intuitive way: There is a client API for .NET applications as well as Silverlight applications. These allow you to consume a data service from within managed code. There is a new data source control that allows the consumption of a data service using the familiar data source paradigm with an ASP.NET application, that can be easily connected to a GridView, ListView, FormView, or DetailsView. Finally there is a client-side API that allows data service consumption using the ASP.NET AJAX library. With these four client options, you are able to consume a data service from within any .NET application, regardless of the environment.
  22. Estimated Time: 3 minutesTalking Points: When using the .NET client API, the DataServiceContext class represents your connection to the data service. The DataServiceContext class provides a lot of functionality around consuming a data service. The arguable two most notable features it provides are: An abstraction layer over the HTTP requests made to the service Object materialization Writing the code required to communicate with a data service using the HttpWebRequest class wouldn’t be that hard, but it would quickly get pretty verbose and time-consuming. Being able to use the DataServiceContext class saves you the effort of working at the HTTP-level completely (there are hooks that let you peer into it if you need to) and allows you to simply request the data you want and let the API handle the plumbing for you. As we saw in our previous examples, the data service returns data in AtomPub format by default, which is great, but would be a pain to have to manually parse in our client application. Fortunately the DataServiceContext class provides full object materialization which translates the returned AtomPub content into CLR objects that we can easily use. The best part about the DataServiceContext’s object materialization is that is doesn’t require the client-side model to match the service-side model at all. As the diagram illustrates, the two-models are completely independent and can to a large degree evolve independently.