overview of next-gen technologies raimond brookman it architect info support...

48
Overview of Overview of Next-gen technologies Next-gen technologies Raimond Brookman Raimond Brookman IT Architect IT Architect Info Support Info Support [email protected] [email protected] http://blogs.infosupport.com/raimondb http://blogs.infosupport.com/raimondb

Post on 15-Jan-2016

216 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Overview of Next-gen technologies Raimond Brookman IT Architect Info Support raimondb@infosupport.com raimondb@infosupport.com

Overview of Overview of Next-gen technologiesNext-gen technologies

Raimond BrookmanRaimond BrookmanIT ArchitectIT ArchitectInfo SupportInfo [email protected]@infosupport.comhttp://blogs.infosupport.com/raimondbhttp://blogs.infosupport.com/raimondb

Page 2: Overview of Next-gen technologies Raimond Brookman IT Architect Info Support raimondb@infosupport.com raimondb@infosupport.com

2

WWF

5 Pillars of Connected Systems5 Pillars of Connected Systems

WCFInfocard

ADASP.NET 2.0Atlas / WPF

LINQWinFS

Page 3: Overview of Next-gen technologies Raimond Brookman IT Architect Info Support raimondb@infosupport.com raimondb@infosupport.com

3

AgendaAgenda

IntroductionIntroduction

Windows Presentation Foundation Windows Presentation Foundation (WPF)(WPF)

ASP.NET AtlasASP.NET Atlas

Windows Communication Foundation Windows Communication Foundation (WCF)(WCF)

Windows Workflow Foundation (WWF)Windows Workflow Foundation (WWF)

C# 3.0, LINQ, DLINQ & XLINQC# 3.0, LINQ, DLINQ & XLINQ

Q&AQ&A

Page 4: Overview of Next-gen technologies Raimond Brookman IT Architect Info Support raimondb@infosupport.com raimondb@infosupport.com

4

Windows Presentation Windows Presentation FoundationFoundation

Page 5: Overview of Next-gen technologies Raimond Brookman IT Architect Info Support raimondb@infosupport.com raimondb@infosupport.com

5

User Experience Matters User Experience Matters Consumer SoftwareConsumer Software

HTML DHTML WinFX

Page 6: Overview of Next-gen technologies Raimond Brookman IT Architect Info Support raimondb@infosupport.com raimondb@infosupport.com

6

Developer ArtDeveloper Art

Page 7: Overview of Next-gen technologies Raimond Brookman IT Architect Info Support raimondb@infosupport.com raimondb@infosupport.com

7

Windows Presentation Windows Presentation FoundationFoundation

BUILD THE APPLICATIONS YOUALWAYS DREAMED OF

BUILD THE APPLICATIONS YOUALWAYS DREAMED OF

Page 8: Overview of Next-gen technologies Raimond Brookman IT Architect Info Support raimondb@infosupport.com raimondb@infosupport.com

8

WPF CapabilitiesWPF Capabilities

Media Integration LayerMedia Integration Layer

2D2D

3D3D

AudioAudioImagingImagingTextText

VideoVideoEffectsEffects

Composition EngineComposition Engine

AnimationAnimation

Base ServicesBase Services

XAMLXAML

AccessibilityAccessibility

Property SystemProperty System

Input & EventingInput & Eventing

Document ServicesDocument Services

XPS DocumentsXPS Documents

Packaging Services

Packaging Services

User Interface ServicesUser Interface Services

Application ServicesApplication Services

Deployment Services

Deployment Services

ControlsControls

LayoutLayout

Databinding

Databinding

Page 9: Overview of Next-gen technologies Raimond Brookman IT Architect Info Support raimondb@infosupport.com raimondb@infosupport.com

9

WPF: User Interface WPF: User Interface ServicesServices

Layout & Databinding<StackPanel>

<Label>Select A Customer</Label><ListBox

Name="myListBox"Background="HoneyDew"ItemsSource="{Binding

{StaticResource myDataSource}}" </ListBox>

</StackPanel>

User Interface ServicesUser Interface Services

Application ServicesApplication Services

Deployment Services

Deployment Services

ControlsControls

LayoutLayout

Databinding

Databinding

Page 10: Overview of Next-gen technologies Raimond Brookman IT Architect Info Support raimondb@infosupport.com raimondb@infosupport.com

10

Window1.xaml.csWindow1.xaml.cs

Contains:Contains:Application logicApplication logic

Created by:Created by:Application Application developerdeveloper

Window1.xamlWindow1.xaml

Contains:Contains:Principal UIPrincipal UI

(controls, layout, (controls, layout, etc.)etc.)

Created by:Created by:Application Application

developer developer oror designerdesigner

Design Design Experience:Experience:

By hand or using a By hand or using a visual toolvisual tool

Styles.xamlStyles.xaml

Contains:Contains:Application “style”Application “style”(visual description (visual description

of UI elements)of UI elements)

Created by:Created by:Application Application designerdesigner

Design Design Experience:Experience:

By hand or using a By hand or using a visual toolvisual tool

projectproject structurestructure

Data model, event names, Data model, event names, element names, etc.element names, etc.

Resource names and Resource names and element types.element types.

Page 11: Overview of Next-gen technologies Raimond Brookman IT Architect Info Support raimondb@infosupport.com raimondb@infosupport.com

11

ASP.NET: Future Directions ASP.NET: Future Directions Developing Rich Web Applications Developing Rich Web Applications With “Atlas”With “Atlas”

Page 12: Overview of Next-gen technologies Raimond Brookman IT Architect Info Support raimondb@infosupport.com raimondb@infosupport.com

12

ASP.NET “Atlas” GoalsASP.NET “Atlas” Goals

Increased productivityIncreased productivityFewer concepts, fewer lines of codeFewer concepts, fewer lines of codeApplication and UI building blocks for common scenariosApplication and UI building blocks for common scenarios

Easier to author, debug, and maintainEasier to author, debug, and maintainClean separation of content, style, behavior, and codeClean separation of content, style, behavior, and codeWell integrated with design and development toolsWell integrated with design and development tools

Seamlessly integrated application modelSeamlessly integrated application modelWorks with ASP.NET pages and server controlsWorks with ASP.NET pages and server controlsAllows access to ASP.NET-hosted web services and Allows access to ASP.NET-hosted web services and componentscomponents

Works everywhere – cross-browser, standards Works everywhere – cross-browser, standards basedbased

A FRAMEWORK FOR BUILDING RICHER, MORE INTERACTIVE,

MORE PERSONALIZED WEB EXPERIENCES

A FRAMEWORK FOR BUILDING RICHER, MORE INTERACTIVE,

MORE PERSONALIZED WEB EXPERIENCES

Page 13: Overview of Next-gen technologies Raimond Brookman IT Architect Info Support raimondb@infosupport.com raimondb@infosupport.com

13

““Atlas” ArchitectureAtlas” Architecture

‘Atlas” Client Script Library‘Atlas” Client Script Library

Built-in Controls and

Behaviors

Built-in Controls and

Behaviors

Script CoreScript Core

Base Class LibraryBase Class Library

Component and UI Model

Component and UI Model

Browser CompatibilityBrowser Compatibility

“Atlas” Client Application Services

“Atlas” Client Application Services

Local StoreLocal Store

BrowserIntegration

BrowserIntegration

ASP.NET “Atlas” Server ExtensionsASP.NET “Atlas” Server Extensions

“Atlas” Server

Controls

“Atlas” Server

Controls

ASP.NET “Atlas” Application

Services

ASP.NET “Atlas” Application

Services

“Atlas” Web Services

Bridge

“Atlas” Web Services

Bridge

ASP.NET 2.0ASP.NET 2.0

ASP.NETApplication

Services

ASP.NETApplication

Services

Page Framework

AndServer Controls

Page Framework

AndServer Controls

““Atlas”-enabled Atlas”-enabled ASP.NET PagesASP.NET Pages

““Atlas”-enabled Atlas”-enabled ASP.NET PagesASP.NET Pages ASP.NET-hostedASP.NET-hosted

Web ServicesWeb Services(ASMX or WCF)(ASMX or WCF)

ASP.NET-hostedASP.NET-hostedWeb ServicesWeb Services(ASMX or WCF)(ASMX or WCF)

ASP.NET “Atlas” ServerASP.NET “Atlas” Server

““Atlas” HTML Atlas” HTML PagePage

““Atlas” HTML Atlas” HTML PagePage ““Atlas”Atlas”

ServiceServiceProxiesProxies

““Atlas”Atlas”ServiceServiceProxiesProxies

“Atlas” Client“Atlas” Client

Page 14: Overview of Next-gen technologies Raimond Brookman IT Architect Info Support raimondb@infosupport.com raimondb@infosupport.com

14

Script-Based Type SystemScript-Based Type System

Scenario:Scenario:Script code can be ad-hoc, unmaintainable, etc.Script code can be ad-hoc, unmaintainable, etc.

Solution:Solution:Encapsulate data and logic into classes and Encapsulate data and logic into classes and componentscomponentsExpose intuitive object modelExpose intuitive object model

““Atlas” OOP constructs built on top of Atlas” OOP constructs built on top of standard script constructs and techniquesstandard script constructs and techniques

NamespacesNamespacesClasses, Interfaces, and inheritanceClasses, Interfaces, and inheritance

Properties, methods, eventsProperties, methods, eventsPrivate and public membersPrivate and public members

DelegatesDelegatesEnumerations and FlagsEnumerations and Flags

Page 15: Overview of Next-gen technologies Raimond Brookman IT Architect Info Support raimondb@infosupport.com raimondb@infosupport.com

15

API SamplesAPI Samplesvar myArray = new Array(‘abc’, ‘ghi’);myArray.push(‘jkl’);myArray.splice(1, 0, ‘def’);

var myObject = ...;var s = ‘’;for (var name in myObject) { var value = myObject[name]; s += name + ‘ = ‘ + value + ‘\r\n’;}

var myArray = new Array(‘abc’, ‘ghi’);var myArray = new Array(‘abc’, ‘ghi’);myArray.add(‘jkl’);myArray.add(‘jkl’);myArray.insert(1, ‘def’);myArray.insert(1, ‘def’);

var myObject = ...;var myObject = ...;var s = ‘’;var s = ‘’;for (var name in myObject) {for (var name in myObject) { var value = myObject[name];var value = myObject[name]; s += String.Format(‘{0} = {1}\r\n’,s += String.Format(‘{0} = {1}\r\n’, name, value, value.length);name, value, value.length);}}

var myObject = ‘...’;var myObject = ‘...’;var sb = new Web.StringBuilder();var sb = new Web.StringBuilder();for (var name in myObject) {for (var name in myObject) { var value = myObject[name];var value = myObject[name]; sb.append(name);sb.append(name); sb.append(‘ = ‘);sb.append(‘ = ‘); sb.appendLine(value);sb.appendLine(value);}}var s = sb.toString();var s = sb.toString();

Page 16: Overview of Next-gen technologies Raimond Brookman IT Architect Info Support raimondb@infosupport.com raimondb@infosupport.com

16

““Atlas” NetworkingAtlas” NetworkingClient networking stack layered on XMLHTTPClient networking stack layered on XMLHTTP

WebRequestWebRequest, , WebResponseWebResponse, , MethodRequestMethodRequest classes classes

ASP.NET “Atlas” Web Services BridgeASP.NET “Atlas” Web Services BridgeAccess to ASP.NET-hosted and serviced componentsAccess to ASP.NET-hosted and serviced components

ASMX and WCF services, .NET objects, ASP.NET page-level ASMX and WCF services, .NET objects, ASP.NET page-level servicesservices

Automatic client proxy generation Automatic client proxy generation <script src=“MyService.asmx/js” /><script src=“MyService.asmx/js” />

Integrated with ASP.NET intrinsicsIntegrated with ASP.NET intrinsics

Wire format: Javascript object notationWire format: Javascript object notationpublic class Location {public class Location { public Point Coordinates;public Point Coordinates; public String Name;public String Name;}}

public class Location {public class Location { public Point Coordinates;public Point Coordinates; public String Name;public String Name;}}

{ Coordinates : { X: 2.17, Y: 48.51 },{ Coordinates : { X: 2.17, Y: 48.51 },

Name : Name : ""Eiffel Tower" }Eiffel Tower" }

{ Coordinates : { X: 2.17, Y: 48.51 },{ Coordinates : { X: 2.17, Y: 48.51 },

Name : Name : ""Eiffel Tower" }Eiffel Tower" }

Page 17: Overview of Next-gen technologies Raimond Brookman IT Architect Info Support raimondb@infosupport.com raimondb@infosupport.com

17

Introduction to the Windows Introduction to the Windows Communication FoundationCommunication Foundation

Page 18: Overview of Next-gen technologies Raimond Brookman IT Architect Info Support raimondb@infosupport.com raimondb@infosupport.com

18

Windows Communication Windows Communication Foundation – Why?Foundation – Why?

WindowsWindowsCommunicationCommunication

FoundationFoundation

ASMXASMX[ with WSE ][ with WSE ] .NET Remoting.NET Remoting COM+COM+

Enterprise ServicesEnterprise Services

Simple ConfigurationSimple ConfigurationOpen StandardsOpen StandardsService-OrientedService-Oriented

AttributesAttributesTransactionsTransactionsComponentsComponents

ExtensibleExtensibleObject-OrientedObject-Oriented

MSMQMSMQSystem.MessagingSystem.Messaging

MessagesMessagesReliableReliable

Page 19: Overview of Next-gen technologies Raimond Brookman IT Architect Info Support raimondb@infosupport.com raimondb@infosupport.com

19

Unifies today’s distributed technology Unifies today’s distributed technology stacksstacksAppropriate for use on-machine, cross Appropriate for use on-machine, cross machine, and cross Internetmachine, and cross Internet

The unified programming model for rapidly building The unified programming model for rapidly building service-oriented applications on the Windows platformservice-oriented applications on the Windows platform

Interoperates with applications running on Interoperates with applications running on other platformsother platformsIntegrates with our own distributed stacksIntegrates with our own distributed stacks

UnificationUnification

IntegrationIntegration

• Codifies best practices for building Codifies best practices for building distributed applicationsdistributed applications

ServiceServiceOrientationOrientation

Windows Communication Windows Communication FoundationFoundation

Page 20: Overview of Next-gen technologies Raimond Brookman IT Architect Info Support raimondb@infosupport.com raimondb@infosupport.com

20

Client Service

Clients and ServicesClients and Services

Message

Page 21: Overview of Next-gen technologies Raimond Brookman IT Architect Info Support raimondb@infosupport.com raimondb@infosupport.com

21

Client Service

EndpointsEndpoints

EndpointEndpoint

Endpoint

EndpointMessage

Page 22: Overview of Next-gen technologies Raimond Brookman IT Architect Info Support raimondb@infosupport.com raimondb@infosupport.com

22

Service

CBA

CBA

Client

Address, Binding, ContractAddress, Binding, Contract

ABC

AddressWhere?

ContractWhat?

BindingHow?

EndpointEndpoint

CBAMessage

Page 23: Overview of Next-gen technologies Raimond Brookman IT Architect Info Support raimondb@infosupport.com raimondb@infosupport.com

23

ServiceHost

Client Service

Creating EndpointsCreating Endpoints

ClientChannel

Message

ABC CBA

CBA

CBA

Page 24: Overview of Next-gen technologies Raimond Brookman IT Architect Info Support raimondb@infosupport.com raimondb@infosupport.com

24

Inside BindingsInside Bindings

Transport

IPCMSMQ

Custom

TCP HTTP

ProtocolEncoders

Binary

Text

Custom

.NETTX

Custom

Security RM

BindingHTTP Text TXSecurity RM

Page 25: Overview of Next-gen technologies Raimond Brookman IT Architect Info Support raimondb@infosupport.com raimondb@infosupport.com

25

Standard BindingsStandard Bindings

Inte

rop

Inte

rop

Secu

rityS

ecu

rity

Sessio

nS

essio

n

Tra

nsa

ction

Tra

nsa

ction

ss Du

ple

xD

uple

x

Stre

am

ing

Stre

am

ing

BasicHttpBindingBasicHttpBinding BP BP 1.11.1

TT

WsHttpBindingWsHttpBinding WSWS T | ST | S XX XX

WsDualHttpBindingWsDualHttpBinding WSWS T | ST | S XX XX XX

NetTcpBindingNetTcpBinding .NET.NET T | ST | S XX XX XX OONetNamedPipesBindingNetNamedPipesBinding .NET.NET T | ST | S XX XX XX OONetMsmqBindingNetMsmqBinding .NET.NET T | ST | S XX XX

NetPeerTcpBindingNetPeerTcpBinding .NET.NET T | ST | S XXT = Transport Security T = Transport Security || S = WS-Security | O = One-Way Only S = WS-Security | O = One-Way Only

Page 26: Overview of Next-gen technologies Raimond Brookman IT Architect Info Support raimondb@infosupport.com raimondb@infosupport.com

26

ASMX/WSE3ASMX/WSE3 WCFWCF

WCFWCF ASMX/WSE3ASMX/WSE3

Integration using BindingsIntegration using Bindings

MSMQMSMQ WCFWCF

WCFWCF MSMQMSMQ

WS-* ProtocolsWS-* Protocols

WS-* ProtocolsWS-* Protocols

MSMQ MSMQ ProtocolProtocol

MSMQ MSMQ ProtocolProtocol

MSMQBinding

MSMQBinding

Http/WSBinding

Http/WSBinding

JavaJava WCFWCF

WCFWCF JavaJava

WS-* ProtocolsWS-* Protocols

WS-* ProtocolsWS-* Protocols

Http/WSBinding

Http/WSBinding

WCFWCF WCFWCFWS-* ProtocolsWS-* Protocols *Binding

*Binding

Page 27: Overview of Next-gen technologies Raimond Brookman IT Architect Info Support raimondb@infosupport.com raimondb@infosupport.com

27

Windows Workflow Windows Workflow FoundationFoundation

Page 28: Overview of Next-gen technologies Raimond Brookman IT Architect Info Support raimondb@infosupport.com raimondb@infosupport.com

28

The The workflow framework & toolsworkflow framework & tools for for Microsoft products and Microsoft products and

partner/customer ecosystempartner/customer ecosystem

Windows Workflow Foundation Windows Workflow Foundation

Single workflow technologySingle workflow technology for Windows for WindowsBase for Microsoft products and ISV/customer solutionsBase for Microsoft products and ISV/customer solutions

One technology for human and system workflow scenariosOne technology for human and system workflow scenarios

A A frameworkframework for building workflow into applications for building workflow into applicationsA framework to build on - not an application or serverA framework to build on - not an application or server

Exposed to developers via WinFXExposed to developers via WinFX

Brings workflow to Brings workflow to mainstreammainstream .NET .NET developmentdevelopment

Transform workflow from niche to mainstream paradigmTransform workflow from niche to mainstream paradigm

Build strong partner & solution ecosystemBuild strong partner & solution ecosystem

Page 29: Overview of Next-gen technologies Raimond Brookman IT Architect Info Support raimondb@infosupport.com raimondb@infosupport.com

29

What Is A Workflow?What Is A Workflow?A set of A set of activitiesactivities that coordinate that coordinate

peoplepeopleand / or software...and / or software...

EscalateToManagerExample activities…. Example activities…. CheckInventory

Like a flowchart…. Like a flowchart….

……organized into a organized into a workflowworkflow..

Or a state diagram…. Or a state diagram….

Page 30: Overview of Next-gen technologies Raimond Brookman IT Architect Info Support raimondb@infosupport.com raimondb@infosupport.com

30

Workflow Scenario SpectrumWorkflow Scenario Spectrum

ParticipantsParticipants: people, roles: people, roles

Flow style:Flow style: flexible, dynamic flexible, dynamic

Data:Data: unstructured, unstructured, documentsdocuments

Participants:Participants: apps, services apps, services

Flow style:Flow style: prescriptive, protocols prescriptive, protocols

Data:Data: structured, transactional structured, transactional

Information Worker• Document Review…Information Worker• Document Review…

System WorkflowSystem WorkflowSystem WorkflowSystem WorkflowHuman Human WorkflowWorkflowHuman Human

WorkflowWorkflow

Windows Workflow FoundationWindows Workflow Foundation

Business to Business• Supply Chain Mgmt…Business to Business• Supply Chain Mgmt…

Line of Business Apps• Quote to Cash, Sales Automation…

Line of Business Apps• Quote to Cash, Sales Automation…CRM ERP

IT Management• New Hire Provisioning, Trouble Ticket,…

IT Management• New Hire Provisioning, Trouble Ticket,…

.NET Developer• Pageflow, Service Coordination…

.NET Developer• Pageflow, Service Coordination…

Page 31: Overview of Next-gen technologies Raimond Brookman IT Architect Info Support raimondb@infosupport.com raimondb@infosupport.com

31WinFXWinFX

Workflow And BizTalk Workflow And BizTalk ServerServer

Windows Windows Workflow Workflow

FoundationFoundation

MessagingMessagingDesigDesig

nnToolsTools

BusineBusinessss

ActivityActivityMonitoMonito

rrAndAnd

AdminAdminToolsTools

OrchestratioOrchestrationn

TransformatiTransformationon

AdaptersAdapters

BizTalk ServerAcceleratorsAccelerators

• Premium BPM serverPremium BPM server• Distinct server productDistinct server product• Use in B2B, EAI, BPM scenariosUse in B2B, EAI, BPM scenarios• Deployable solutionsDeployable solutions• Manageability, Scale-outManageability, Scale-out

• Workflow frameworkWorkflow framework• Exposed via WinFX Exposed via WinFX • Broad set of scenarios Broad set of scenarios • Used to build solutionsUsed to build solutions• Enables manageabilityEnables manageabilityand scale-out in solutionsand scale-out in solutions• Use for building workflow Use for building workflow into apps or workflow-enabled into apps or workflow-enabled serversservers

Visual Studio DesignerVisual Studio Designer

• Future version will migrate to Future version will migrate to Windows Workflow Foundation Windows Workflow Foundation for orchestrationfor orchestration

WorkflowWorkflow

Page 32: Overview of Next-gen technologies Raimond Brookman IT Architect Info Support raimondb@infosupport.com raimondb@infosupport.com

32

Windows Workflow FoundationWindows Workflow Foundation

Key ConceptsKey Concepts

Host Process

WindowsWorkflow Foundation

Runtime Engine

A Workflow

An Activity

Runtime Services

Base Activity Library

Custom Activity Library

Visual Designer

Visual Designer:Visual Designer: Graphical and code-Graphical and code-based constructionbased construction

WorkflowsWorkflows are a set of are a set of ActivitiesActivities

Workflows run within a Workflows run within a Host Host Process: Process: any application or serverany application or serverDevelopers can build their own Developers can build their own Custom Activity LibrariesCustom Activity Libraries

ComponentsComponents

Base Activity Library:Base Activity Library: Out-of-box Out-of-box activities and base for custom activitiesactivities and base for custom activities

Runtime Engine:Runtime Engine: Workflow execution Workflow execution and state managementand state management

Runtime Services:Runtime Services: Hosting flexibility Hosting flexibility and communicationand communication

Page 33: Overview of Next-gen technologies Raimond Brookman IT Architect Info Support raimondb@infosupport.com raimondb@infosupport.com

33

Visual DesignerVisual Designer

DesignDesign

DebugDebug

Page 34: Overview of Next-gen technologies Raimond Brookman IT Architect Info Support raimondb@infosupport.com raimondb@infosupport.com

34

The .NET LanguageThe .NET LanguageC# 3.0 Integrated Query C# 3.0 Integrated Query ProjectProject

Page 35: Overview of Next-gen technologies Raimond Brookman IT Architect Info Support raimondb@infosupport.com raimondb@infosupport.com

35

Getting productiveGetting productive

Today we program against relational Today we program against relational and hierarchical data using a and hierarchical data using a language that does not support this language that does not support this nativelynatively

Data != ObjectsData != Objects

We are busy describing how things We are busy describing how things need to get done in stead of what we need to get done in stead of what we wantwant

Page 36: Overview of Next-gen technologies Raimond Brookman IT Architect Info Support raimondb@infosupport.com raimondb@infosupport.com

36

C# 3.0 Design GoalsC# 3.0 Design Goals

Integrate objects, relational, and XMLIntegrate objects, relational, and XML

Build on foundation laid in C# 1.0 and Build on foundation laid in C# 1.0 and

2.02.0

Run on the .NET 2.0 (“Whidbey”) CLRRun on the .NET 2.0 (“Whidbey”) CLR

Remain 100% backwards compatibleRemain 100% backwards compatible

Page 37: Overview of Next-gen technologies Raimond Brookman IT Architect Info Support raimondb@infosupport.com raimondb@infosupport.com

37

The LINQ ProjectThe LINQ Project

StandardStandardQueryQuery

OperatorsOperators

ObjectsObjects

DLinqDLinq(ADO.NET)(ADO.NET)

XLinqXLinq(System.Xml)(System.Xml)

<book> <title/> <author/> <year/> <price/></book>

XMLXML

.NET Language Integrated Query.NET Language Integrated Query

C# 3.0C# 3.0 VB 9.0VB 9.0 Others…Others…

SQLSQL WinFWinFSS

Page 38: Overview of Next-gen technologies Raimond Brookman IT Architect Info Support raimondb@infosupport.com raimondb@infosupport.com

38

LINQ Style programmingLINQ Style programming

var contacts =var contacts = from c in customersfrom c in customers where c.State == "WA"where c.State == "WA" select new { c.Name, c.Phone };select new { c.Name, c.Phone };

class Contact { … };class Contact { … };List<Contact> contacts = new List<Contacts>();List<Contact> contacts = new List<Contacts>();foreach(Customer c in customers) foreach(Customer c in customers) {{

if(c.State == “WA”) if(c.State == “WA”) {{ Contact ct = new Contact();Contact ct = new Contact(); ct.Name = c.Name;ct.Name = c.Name; ct.Phone = c.Phone;ct.Phone = c.Phone; contacts.Add(ct);contacts.Add(ct);}}

}}

Page 39: Overview of Next-gen technologies Raimond Brookman IT Architect Info Support raimondb@infosupport.com raimondb@infosupport.com

39

Query ExpressionsQuery Expressions

Language integrated query syntaxLanguage integrated query syntax

fromfrom idid inin sourcesource{ { fromfrom idid inin sourcesource | | wherewhere conditioncondition } }[ [ orderbyorderby orderingordering, , orderingordering, … ], … ]selectselect exprexpr | | groupgroup exprexpr byby keykey[ [ intointo idid queryquery ] ]

Page 40: Overview of Next-gen technologies Raimond Brookman IT Architect Info Support raimondb@infosupport.com raimondb@infosupport.com

40

C# 3.0 Language C# 3.0 Language InnovationsInnovations

var contacts =var contacts = from c in customersfrom c in customers where c.State == "WA"where c.State == "WA" select new { c.Name, c.Phone };select new { c.Name, c.Phone };

var contacts =var contacts = customerscustomers .Where(c => c.State == "WA").Where(c => c.State == "WA") .Select(c => new { c.Name, c.Phone });.Select(c => new { c.Name, c.Phone });

Extension Extension methodsmethods

Lambda Lambda expressionsexpressions

Query Query expressionsexpressions

Object Object initializersinitializers

Anonymous Anonymous typestypes

Local Local variable type variable type

inferenceinference

Page 41: Overview of Next-gen technologies Raimond Brookman IT Architect Info Support raimondb@infosupport.com raimondb@infosupport.com

41

Standard Query OperatorsStandard Query OperatorsRestrictionRestriction WhereWhere

ProjectionProjection Select, SelectManySelect, SelectMany

OrderingOrdering OrderBy, ThenByOrderBy, ThenBy

GroupingGrouping GroupByGroupBy

QuantifiersQuantifiers Any, AllAny, All

PartitioningPartitioning Take, Skip, TakeWhile, SkipWhileTake, Skip, TakeWhile, SkipWhile

SetsSets Distinct, Union, Intersect, ExceptDistinct, Union, Intersect, Except

ElementsElements First, FirstOrDefault, ElementAtFirst, FirstOrDefault, ElementAt

AggregationAggregation Count, Sum, Min, Max, AverageCount, Sum, Min, Max, Average

ConversionConversion ToArray, ToList, ToDictionaryToArray, ToList, ToDictionary

CastingCasting OfType<T>OfType<T>

Page 42: Overview of Next-gen technologies Raimond Brookman IT Architect Info Support raimondb@infosupport.com raimondb@infosupport.com

42

DLinq For Relational DataDLinq For Relational Data

SqlConnection c = new SqlConnection(…);SqlConnection c = new SqlConnection(…);c.Open();c.Open();SqlCommand cmd = new SqlCommand(SqlCommand cmd = new SqlCommand( @"SELECT c.Name, c.Phone@"SELECT c.Name, c.Phone FROM Customers cFROM Customers c WHERE c.City = @p0");WHERE c.City = @p0");cmd.Parameters.AddWithValue("@p0", cmd.Parameters.AddWithValue("@p0", "London“);"London“);DataReader dr = c.Execute(cmd);DataReader dr = c.Execute(cmd);while (dr.Read()) {while (dr.Read()) { string name = dr.GetString(0);string name = dr.GetString(0); string phone = dr.GetString(1);string phone = dr.GetString(1); DateTime date = dr.GetDateTime(2);DateTime date = dr.GetDateTime(2);}}dr.Close();dr.Close();

Accessing data todayAccessing data todayQueries in Queries in

quotesquotes

Loosely Loosely bound bound

argumentsarguments

Loosely Loosely typed result typed result

setssets

No compile No compile time checkstime checks

Page 43: Overview of Next-gen technologies Raimond Brookman IT Architect Info Support raimondb@infosupport.com raimondb@infosupport.com

43

public class Customer { … }public class Customer { … }

public class Northwind: DataContextpublic class Northwind: DataContext{{ public Table<Customer> Customers;public Table<Customer> Customers; … …}}

Northwind db = new Northwind(…);Northwind db = new Northwind(…);var contacts =var contacts = from c in db.Customersfrom c in db.Customers where c.City == "London"where c.City == "London" select new { c.Name, c.Phone };select new { c.Name, c.Phone };

DLinq For Relational DataDLinq For Relational Data

Accessing data with DLinqAccessing data with DLinqClasses Classes

describe datadescribe data

Strongly Strongly typed typed

connectionconnection

Integrated Integrated query syntaxquery syntax

Strongly Strongly typed resultstyped results

Tables are Tables are like like

collectionscollections

Page 44: Overview of Next-gen technologies Raimond Brookman IT Architect Info Support raimondb@infosupport.com raimondb@infosupport.com

44

XLinq For XML DataXLinq For XML Data

XmlDocument doc = new XmlDocument();XmlDocument doc = new XmlDocument();XmlElement contacts = doc.CreateElement("contacts");XmlElement contacts = doc.CreateElement("contacts");foreach (Customer c in customers)foreach (Customer c in customers) if (c.Country == "USA") {if (c.Country == "USA") { XmlElement e = doc.CreateElement("contact");XmlElement e = doc.CreateElement("contact"); XmlElement name = doc.CreateElement("name");XmlElement name = doc.CreateElement("name"); name.InnerText = c.CompanyName;name.InnerText = c.CompanyName; e.AppendChild(name);e.AppendChild(name); XmlElement phone = doc.CreateElement("phone");XmlElement phone = doc.CreateElement("phone"); phone.InnerText = c.Phone;phone.InnerText = c.Phone; e.AppendChild(phone);e.AppendChild(phone); contacts.AppendChild(e);contacts.AppendChild(e); }}doc.AppendChild(contacts);doc.AppendChild(contacts);

Programming XML todayProgramming XML today

<contacts><contacts> <contact><contact> <name>Great Lakes <name>Great Lakes Food</name>Food</name> <phone>(503) <phone>(503) 555-7123</phone>555-7123</phone> </contact></contact> … …</contacts></contacts>

Imperative Imperative modelmodel

Document Document centriccentric

No integrated No integrated queriesqueries

Memory Memory intensiveintensive

Page 45: Overview of Next-gen technologies Raimond Brookman IT Architect Info Support raimondb@infosupport.com raimondb@infosupport.com

45

XLinq For XML DataXLinq For XML Data

XElement contacts = new XElement("contacts",XElement contacts = new XElement("contacts", from c in customersfrom c in customers where c.Country == "USA"where c.Country == "USA" select new XElement("contact",select new XElement("contact", new XElement("name", c.CompanyName),new XElement("name", c.CompanyName), new XElement("phone", c.Phone)new XElement("phone", c.Phone) ))););

Programming XML with XLinqProgramming XML with XLinqDeclarative Declarative

modelmodel

<contacts><contacts> <contact><contact> <name>Great Lakes <name>Great Lakes Food</name>Food</name> <phone>(503) <phone>(503) 555-7123</phone>555-7123</phone> </contact></contact> … …</contacts></contacts>

ElementElementcentriccentric

Integrated Integrated queriesqueries

Smaller and Smaller and fasterfaster

Page 46: Overview of Next-gen technologies Raimond Brookman IT Architect Info Support raimondb@infosupport.com raimondb@infosupport.com

46

XLinq For XML DataXLinq For XML Data

Language integrated query for XMLLanguage integrated query for XMLExpressive power of XPath / XQueryExpressive power of XPath / XQuery

But with C# or VB as programming But with C# or VB as programming languagelanguage

Leverages experience with DOMLeverages experience with DOMElement centric, not document centricElement centric, not document centric

Functional constructionFunctional construction

Text nodes are just stringsText nodes are just strings

Simplified XML namespace supportSimplified XML namespace support

Faster and smallerFaster and smaller

Page 47: Overview of Next-gen technologies Raimond Brookman IT Architect Info Support raimondb@infosupport.com raimondb@infosupport.com

47

Benefits Of LINQBenefits Of LINQ

Unified querying of objects, relational, XMLUnified querying of objects, relational, XML

Type checking and IntelliSense for queries Type checking and IntelliSense for queries

SQL and XQuery-like power in C# and VBSQL and XQuery-like power in C# and VB

Extensibility model for languages / APIsExtensibility model for languages / APIs

Describe What, not how boosts Describe What, not how boosts

productivityproductivity

Page 48: Overview of Next-gen technologies Raimond Brookman IT Architect Info Support raimondb@infosupport.com raimondb@infosupport.com

48

Questions?Questions?