Brian Noyes Chief Architect IDesign Inc () SOA201.
-
Upload
regina-thompson -
Category
Documents
-
view
224 -
download
0
Transcript of Brian Noyes Chief Architect IDesign Inc () SOA201.
A First Look at WCF and WF in the Microsoft .NET Framework 4.0
Brian NoyesChief ArchitectIDesign Inc (www.idesign.net) SOA201
Chief ArchitectIDesign Inc. (www.idesign.net)
Microsoft Regional DirectorMVP
Microsoft MVPConnected Systems
About Brian Publishing
Developing Applications with Windows Workflow Foundation, LiveLessons training DVD, June 2007
Smart Client Deployment with ClickOnce, Addison Wesley, January 2007
Data Binding in Windows Forms 2.0, Addison Wesley, January 2006
MSDN Magazine, MSDN Online, CoDe Magazine, The Server Side .NET, asp.netPRO, Visual Studio Magazine
Speaking
Microsoft TechEd US, Europe, Malaysia, Visual Studio Connections, DevTeach, INETA Speakers Bureau, MSDN Webcasts
E-mail: [email protected]
Blog: http://briannoyes.net
WCF & WF 4.0
Primary focus on bringing WCF + WF together
WF 4.0WCF 4.0
Simplifies developer experience
Enables new scenarios/features
Fairly minor in terms of impact to your applications
Major rewrite
Redesign of WF runtime and programming model
Need to relearn new approach
WCF 4.0 Features
New WCF 4.0 Features
Simplified configurationDiscoveryRouter serviceImproved REST supportMisc. advanced features
Simplified Configuration
New support for default service configurationsDefault binding & behavior configurationsImplicit endpoint configurations
Much easier to get services up and runningRemoves the need for <service> configurationAlso enables file-less activation (no .svc)
Need to use with careImplicit anything can be a maintenance and debugging nightmare
Service Discovery
WCF 4.0 provides two types of service discovery
Clients can discover services on a local subnet (UDP-based)
Clients can discover services on a larger "managed" network (beyond the local subnet) through a discovery proxy
Adhoc Managed
Enabled via the serviceDiscovery behavior,clients "discover" services using a DynamicEndpoint
New WCF 4.0 Features – Part Idemo
Router Service
First-class "router" serviceContent-based routing, protocol bridging, etcError handling support
You host it like any other WCF serviceConfigure with routing "filters"
Client
Service
Service
Router
"filters"
Improved REST Support
Many features from the WCF REST Starter Kit will become part of WCF 4.0
Automatic help page HTTP caching support
?
New WCF 4.0 Features – Part IIdemo
Advanced WCF Features
DataContractResolver for type resolutionAllows you to override known type resolution
Support for queues with competing consumersAdded a "receive context" feature
High-performance ETW-based tracingBlob encoder
WF 4.0 features
WF 3.x Challenges Today
Limited support for XAML-only workflowsVersioning is problematicLimited base activity libraryWriting custom activities is hardManaging data flow is really hardDesigner is annoying and difficult to rehostRules engine is primitive and not extensible
Moving Towards WF 4.0
Major themes in WF 4.0 include…
Declarative workflow model
(XAML only)
Enhanced baseactivity library
Simplifying custom
activities
Simplifyingdata flow
Runtime improvements
Designerimprovements
XAML-only Workflows
A declarative workflow is fully described within a XAML file (no code-behind)
Has always been the ultimate WF visionPossible in .NET 3.x but not easy
.NET 4.0 makes them first-class citizensEnhancements to programming model remove the need for code-behind files altogetherFull designer support in Visual Studio 2010
Benefits of Declarative Workflows
C#DSL
Visio
Increases hosting & deployment flexibility
It can be represented in different formatsXAML, C#, Visio, custom DSL, etc.
The program definition is just dataIt's typically an XML file that's easy to processSimplifies tool support and designersIt can be stored anywhere (file, DB, cloud, etc.)
Extended Base Activity Library
.NET 4.0 comes with several new/enhanced activities
Flowchart
ForEach
Parallel*
ParallelForEach*
DoWhile
Pick
…
AddToCollection
RemoveFromCollection
ExistsInCollection
ClearCollection
...
Assign
InvokeMethod
Persist
TryCatch
CompensableActivity
Interop
...
Flow Control Collection Others
Microsoft is planning to ship more activities via CodePlex over time* New "parallel" behavior
New Flow Chart Model
Simple step-by-step model, with decisions and switches
Allows you to return to previousactivities in the workflow
Flowcharts offer a middle ground between the sequential and state machine models
Simplified WF Programming Model
WF 4.0 makes it much easier to:Host workflows and run workflow instancesManage workflow bookmarksCreate custom activitiesPass data into activities and store dataUnit test activities and workflowsUse activities outside of workflows
Rules engine
WorkflowElement
Activity CodeActivity NativeActivity
Creating Custom Activities
New Programming Model for Custom Activities
Plus the new DynamicActivity for dynamic activity composition
WF 4.0 Data Flow Constructs
Arguments
Variables
Expressions
Used to define the way data flows in and out of an activity; each argument has a binding direction: input, output, or input/output.
Used to declare named storage for data within an activity; variables can be defined at different scopes within a workflow.
Takes one or more input arguments, performs some operation on those input arguments, and then returns a value.
Arguments and Variables
Flow Chart
Parallel
Sequence
SendMessage
Delay ReceiveMessage
GenerateOrder
InArgument<TimeSpan>
OutArgument<Order>
InArgument<Message>
OutArgument<Message>
ProcessOrder
SendReport
Variables
Variables
Variables
Activities are the primitive abstraction for behaviorActivities define Arguments to declare the type of data that can flow into or out of an ActivityActivities are composable with other ActivitiesActivities have user-defined Variables for data storageActivities bind Arguments to in-scope Variables
WF 4.0 Programming Modeldemo
WCF + WF 4.0:Workflow Services
WCF Workflow ServicesWCF Service
WF Workflow
ClientExternalService
ExternalService
WCF endpoint
WCF endpoint
Workflow Services
New messaging activitiesAdd service reference (Visual Studio)XAML authoring (contracts, bindings, etc)Workflow service host
WCF Activities in .NET 4.0
WF 4.0 comes with new-and-improved WCF activities
Send
Receive
SendAndReceiveReply
ReceiveAndSendReply
Send
Receive
.NET 4.0.NET 3.5
All 4.0 messaging activities come with improvedWCF support including correlation
Message Correlation
When sending and receiving WCF messages, correlation is a common need
.NET 4.0 adds correlation support to WCFWF makes correlation easy to use via activities
Workflow Servicesdemo
The New WF Designer
Improved UsabilityImproved Designer Performance
Major Rehosting Improvements
Unified Debugging Experience
WF Runtime Improvements
Full Control Over Persistence
10-100x Performance Improvements
Flow-in Transactions
Preparing for WF 4.0
Your 3.x workflows will continue to workUsing the WF 3.5 runtime and framework classes
You can use 3.x activities in a 4.0 workflowUse the Interop activity to wrap them
Avoid code activities and handling activity events in code behindMore guidance coming from Microsoft…
http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=bd94c260-b5e0-4d12-93ec-53567505e685#filelist
Summary
WCF/WF 4.0 offers many improvements:WCF + WF integration: Workflow ServicesNew WCF features & messaging improvementsNew WF runtime, programming model, & designer
Lays a solid foundation for building connected systems on the .NET platform
Additional Resources
IDesign WF 4 Master ClassWCF and WF Services in the .NET Framework 4.0 and "Dublin"
http://msdn.microsoft.com/en-us/magazine/2009.01.net40.aspx
The Workflow Way (new whitepaper)http://msdn.microsoft.com/wf/future
Question & Answer
Complete a session evaluation and enter to win!
10 pairs of MP3 sunglasses to be won
© 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS,
IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.