Upload
apc316
View
227
Download
0
Embed Size (px)
Citation preview
8/8/2019 A First Look at WCF and WF in .NET 4.0
1/36
8/8/2019 A First Look at WCF and WF in .NET 4.0
2/36
Aaron SkonnardCofounderPluralsight
SOA201
8/8/2019 A First Look at WCF and WF in .NET 4.0
3/36
About Aaron Skonnard
Cofounder of Pluralsight
Industry think-tank focused on developer training
Recently released Pluralsight On-Demand!
Active in the community
Microsoft MVP for Connected Systems
Author & 10-year columnist for MSDN Magazine
Contact information
Email: [email protected]
Blog: http://pluralsight.com/aaron
Twitter: http://twitter.com/skonnard
8/8/2019 A First Look at WCF and WF in .NET 4.0
4/36
WCF &WF 4.0
Primary focus on bringingWCF +WF together
WF 4.0WF 4.0WCF 4.0WCF 4.0
Enables new scenarios/features
Fairly minor in terms of impactto your applications
Enables some key new features
Major shift in direction
Redesign ofWF runtime andprogramming model
Likely to break today's apps
8/8/2019 A First Look at WCF and WF in .NET 4.0
5/36
8/8/2019 A First Look at WCF and WF in .NET 4.0
6/36
NewWCF 4.0 Features
Workflow services (major focus)
Simplified configuration
Discovery
Router service
Improved REST support
Misc advanced features
8/8/2019 A First Look at WCF and WF in .NET 4.0
7/36
Simplified Configuration
New support for default service configurations
Default binding & behavior configurations
Implicit endpoint configurations
Much easier to get services up and runningRemoves the need for configuration
Also enables .svc-less activation
8/8/2019 A First Look at WCF and WF in .NET 4.0
8/36
Simplified Configuration & Discovery
8/8/2019 A First Look at WCF and WF in .NET 4.0
9/36
Service Discovery
WCF 4.0 provides two types of service discovery
Clients can discoverClients can discoverservices on a localservices on a local
subnet (UDPsubnet (UDP--based)based)
Clients can discoverClients can discoverservices on a largerservices on a larger
"managed" network"managed" network
(beyond the local(beyond the local
subnet) through asubnet) through a
discovery proxydiscovery proxy
AdhocAdhoc ManagedManaged
Enabled via the serviceDiscoverybehavior,clients "discover" services using a DynamicEndpoint
8/8/2019 A First Look at WCF and WF in .NET 4.0
10/36
Router Service
First-class "router" service
Content-based routing, protocol bridging, etc
Error handling support
You host it like any otherWCF serviceConfigure with routing "filters"
Client
Service
Service
Router
"filters"
8/8/2019 A First Look at WCF and WF in .NET 4.0
11/36
Improved REST Support
Many features from theWCF REST Starter Kitwill be part ofWCF 4.0
Automatichelp page
HTTP cachingsupport
Responseformatting
Default endpoint Web exceptions
8/8/2019 A First Look at WCF and WF in .NET 4.0
12/36
Improved REST Support
8/8/2019 A First Look at WCF and WF in .NET 4.0
13/36
AdvancedWCF Features
DataContractResolver for type resolution
Allows you to override known type resolution
Support for queues with competing consumers
Added a "receive context" featureHigh-performance ETW-based tracing
Blob encoder
8/8/2019 A First Look at WCF and WF in .NET 4.0
14/36
8/8/2019 A First Look at WCF and WF in .NET 4.0
15/36
WF 3.x Challenges Today
Limited support for XAML-only workflows
Versioning is problematic
Limited base activity library (no work activities)
Writing custom activities is hard
Managing data flow is reallyhard
LimitedWCF integration and activity support
8/8/2019 A First Look at WCF and WF in .NET 4.0
16/36
Moving TowardsWF 4.0
Major themes inWF 4.0 include
XAML-only model More activities WorkflowServices
Simplifyingcustom activities
Simplifyingdata flow
Runtime/designerimprovements
8/8/2019 A First Look at WCF and WF in .NET 4.0
17/36
XAML-onlyWorkflows
A declarative workflowis fully described withina XAML file (no code-behind)
Has always been the ultimateWF vision
Possible in .NET 3.x but not easy.NET 4.0 makes them first-class citizens
Enhancements to programming model remove theneed for code-behind files altogether
Full designer support in Visual Studio 2010
8/8/2019 A First Look at WCF and WF in .NET 4.0
18/36
Benefits of DeclarativeWorkflows
C#
DSL
VisioVisio
Increases hosting & deployment flexibility
It can be represented in different formatsXAML, C#, Visio, custom DSL, etc.
The program definition isjust dataIt's typically an XML file that's easy to processSimplifies tool support and designersIt can be stored anywhere (file, DB, cloud, etc.)
8/8/2019 A First Look at WCF and WF in .NET 4.0
19/36
Extended Base Activity Library
.NET 4.0 comes with several new activities
FlowchartFlowchart
ForEachForEach
ParallelParallel
ParallelForEachParallelForEach
DoWhileDoWhile
PickPick
AddToCollectionAddToCollection
RemoveFromCollectionRemoveFromCollection
ExistsInCollectionExistsInCollection
ClearCollectionClearCollection
......
AssignAssign
InvokeMethodInvokeMethod
PersistPersist
InteropInterop
......
Flow ControlFlow Control CollectionCollection OthersOthers
Microsoft is planning to ship more activities via CodePlexover time
8/8/2019 A First Look at WCF and WF in .NET 4.0
20/36
New Flow Chart Model
Simple step-by-step model,
with decisions and switches
Allows you to return to previous
activities in the workflow
Flowcharts offer a middle ground betweenthe sequential and state machine models
8/8/2019 A First Look at WCF and WF in .NET 4.0
21/36
SimplifiedWF Programming Model
WF 4.0 makes it much easier to:
Host workflows and run workflow instances
Manage workflow bookmarks
Create custom activitiesPass data into activities and store
8/8/2019 A First Look at WCF and WF in .NET 4.0
22/36
WorkflowElement
Activity CodeActivity NativeActivity
Creating Custom Activities
New programming model for custom activities
Plus the newDynamicActivityfor dynamic activity composition
8/8/2019 A First Look at WCF and WF in .NET 4.0
23/36
WF 4.0 Data Flow Constructs
ArgumentsArguments
VariablesVariables
ExpressionsExpressions
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 operationon those input arguments, and then returns a value.
8/8/2019 A First Look at WCF and WF in .NET 4.0
24/36
Arguments and Variables
State MachineState Machine
Parallel
Sequence
SendSendMessageMessage
DelayDelayReceiveReceive
MessageMessage
GenerateGenerateOrderOrder
InArgument
OutArgument
InArgument
OutArgument
r cessr cessOrderOrder
SendSendRep rtRep rt
Variables
Variables
Variables
Activities are the primitive abstraction for behaviorActivities defineArguments to declare the type of datathat can flow into or out of an Activity
Activities are composable with other ActivitiesActivities have user-defined Variables for data storageActivities bind Arguments to in-scope Variables
8/8/2019 A First Look at WCF and WF in .NET 4.0
25/36
WF 4.0 Programming Model
8/8/2019 A First Look at WCF and WF in .NET 4.0
26/36
WCFWorkflow Services
WCF ServiceWCF Service
WFWorkflowWFWorkflow
ClientClientExternalExternalServiceService
ExternalExternalServiceService
WCF endpointWCF endpoint
WCF endpointWCF endpoint
8/8/2019 A First Look at WCF and WF in .NET 4.0
27/36
Workflow Services
New messaging activities
Add service reference (Visual Studio)
XAML authoring (contracts, bindings, etc)
Workflow service host
8/8/2019 A First Look at WCF and WF in .NET 4.0
28/36
WCF Activities in .NET 4.0
WF 4.0 comes with new-and-improvedWCF activities
SendSend
ReceiveReceive
SendAndReceiveReplySendAndReceiveReply
ReceiveAndSendReplyReceiveAndSendReply
SendSend
ReceiveReceive
.NET 4.0.NET 4.0.NET 3.5.NET 3.5
All 4.0 messaging activities come with improved
WCF support including correlation
8/8/2019 A First Look at WCF and WF in .NET 4.0
29/36
Message Correlation
When sending and receivingWCF messages,correlation is a common need
.NET 4.0 adds correlation support toWCF
WF makes correlation easy to use via activities
8/8/2019 A First Look at WCF and WF in .NET 4.0
30/36
Workflow Services
8/8/2019 A First Look at WCF and WF in .NET 4.0
31/36
The NewWF Designer
Improved usabilityImproved usabilityImproved designerImproved designer
performanceperformance
Major rehostingMajor rehosting
improvementsimprovements
Unified debuggingUnified debugging
experienceexperience
8/8/2019 A First Look at WCF and WF in .NET 4.0
32/36
WF Runtime Improvements
Full controlFull controlover persistenceover persistence
1010--100x Performance100x PerformanceImprovementsImprovements
FlowFlow--in Transactionsin Transactions Partial Trust SupportPartial Trust Support
8/8/2019 A First Look at WCF and WF in .NET 4.0
33/36
Preparing forWF 4.0
Your 3.x workflows will continue to work
Using theWF 3.0 runtime
You can use 3.x activities in a 4.0 workflow
Use the Interop activityMore guidance coming from Microsoft
8/8/2019 A First Look at WCF and WF in .NET 4.0
34/36
Summary
WCF/WF 4.0 offers many improvements:
WCF +WF integration:Workflow Services
NewWCF features & messaging improvements
NewWF runtime, programming model, & designerLays a solid foundation for building connectedsystems on the .NET platform
8/8/2019 A First Look at WCF and WF in .NET 4.0
35/36
Additional Resources
WCF andWF Services in the .NET Framework4.0 and "Dublin"
http://msdn.microsoft.com/en-us/magazine/2009.01.net40.aspx
TheWorkflowWay (new whitepaper)
Screencasts onWCF/WF 4.0:
http://www.pluralsight.com/main/screencasts/
Follow Pluralsight in real-time on Twitter:
http://twitter.com/pluralsight
8/8/2019 A First Look at WCF and WF in .NET 4.0
36/36