Your SlideShare is downloading. ×
0
Workflow Foundation 4
Workflow Foundation 4
Workflow Foundation 4
Workflow Foundation 4
Workflow Foundation 4
Workflow Foundation 4
Workflow Foundation 4
Workflow Foundation 4
Workflow Foundation 4
Workflow Foundation 4
Workflow Foundation 4
Workflow Foundation 4
Workflow Foundation 4
Workflow Foundation 4
Workflow Foundation 4
Workflow Foundation 4
Workflow Foundation 4
Workflow Foundation 4
Workflow Foundation 4
Workflow Foundation 4
Workflow Foundation 4
Workflow Foundation 4
Workflow Foundation 4
Workflow Foundation 4
Workflow Foundation 4
Workflow Foundation 4
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Workflow Foundation 4

3,164

Published on

An introduction to Windows Workflow Foundation (WF) in .NET 4

An introduction to Windows Workflow Foundation (WF) in .NET 4

Published in: Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
3,164
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
45
Comments
0
Likes
2
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Setup Visual Studio Rule 18
  • 2. Workflow Foundation 4
  • 3. 10110000 01100001 What is WF4? MOV AL, 61h Console.WriteLine(Hello!);
  • 4. Why is a picture better? Highlights missing/not completed areas Easy to Understand Patterns
  • 5. Simplify complex patterns Multiple Branches Running in parallel
  • 6. NO... It’s bigger than that So it’s a code visualiser?
  • 7. Evolution
  • 8. Code Activity Ruleset What was lost?
  • 9. Isolation Workflow instances are isolated from the host application and each other. Workflows are not aware of information in the application other than what is passed to it. Threaded Instances are separately threaded from your main thread. Important Concepts
  • 10. Workflow Foundation Demo
  • 11. New Project -> .NET 4 -> Workflow Console App -> OK Drag a WriteLine on -> Set text to "Hello" Run (Ctrl+F5) single activity issue demo: Now try drag on another writeline Remove writeline, bring on a sequence and put two writelines with different messages Add Argument -> Name: Firstname, Direction: In, Type: string Drag a If on (should be only thing on surface) - condition is: String.IsNullOrWhiteSpace(FirstName) Drag a writeline to true and set text to: "Hello, stranger" Drag a writeline to false and set text to: "Hello, " & FirstName Run it - note that it runs stranger Program.cs - explain what is happening Change main to (Ctrl+1): Workflow1 workflow = new Workflow1(); workflow.FirstName = "Robert"; WorkflowInvoker.Invoke(workflow); Run Create new PUBLIC class Person. Add string property FirstName. Build Delete the current workflow argument Add new arguement name=person, direction=in, type=Person Change if condition to: String.IsNullOrWhiteSpace(person.FirstName) Change else writeline: "Hello, " & person.FirstName Build Change main to (Ctrl+2): Person person = new Person(); person.FirstName = "Robert"; Workflow1 workflow = new Workflow1(); workflow.person = person; WorkflowInvoker.Invoke(workflow); Run and fail!
  • 12. Change main to (Ctrl+3): Person person = new Person(); person.FirstName = "Robert"; Dictionary<string, object> parameters = new Dictionary<string, object>(); parameters.Add("person", person); Workflow1 workflow = new Workflow1(); WorkflowInvoker.Invoke(workflow, parameters); Run
  • 13. Alternative Hosts
  • 14. WorkflowInvoker.Invoke(new Workflow1()); Alternative Hosts WorkflowApplication wfApp = new WorkflowApplication(new Workflow1());wfApp.Run(); Uri uri = new Uri("http://localhost:8080/Workflow");WorkflowServiceHost wfHost = new WorkflowServiceHost(new Workflow1(), uri);wfHost.Open();
  • 15. Types of Workflow Sequential State* Flow Chart * http://wf.codeplex.com/
  • 16. Flow chart
  • 17. Remove everything from workflow Drag a flow chart on Drag a flow decision Link start to decision Set decision condition to: String.IsNullOrWhiteSpace(person.FirstName) Show tooltop and tooltip sticky Drag two writelines on and link one to true and one to false true writeline text: "Hello, stranger" false writeline text: "Hello, " & person.FirstName Run Link false writeline to true writeline run
  • 18. Custom activities
  • 19. Add new item -> Code activity Set value to (Ctrl+4) public InArgument<string> FirstName { get; set; } // If your activity returns a value, derive from CodeActivity<TResult> // and return the value from the Execute method. protected override void Execute(CodeActivityContext context) { // Obtain the runtime value of the Text input argument Console.WriteLine(this.FirstName.Get(context)); } Build Drag CodeActivity onto flowchart and link it to true writeline run
  • 20. Passing Data Application Global Instance Variables Database, MSMQ, File, etc… Workflow
  • 21. Services Person person = new Person();person.FirstName = "Robert";Dictionary<string, object> parameters = new Dictionary<string, object>();parameters.Add("person", person);Workflow1 workflow = new Workflow1();StringWriter writer = new StringWriter();WorkflowInvoker invoker = new WorkflowInvoker(workflow);invoker.Extensions.Add(writer);invoker.Invoke(parameters);
  • 22. Services - Persistence Application Application Workflow Runtime Workflow Runtime Wait for event 2o kb Instance C 20 Mb - Executing Instance A 20Mb – 1 Week Instance C 20 Mb - Executing Instance B 20Mb – Event Delay 1 week 2o kb SQL Database Before After
  • 23. Services - Persistence Application Application Workflow Runtime Workflow Runtime Wait for event 2o kb Instance B Sleeping 20Kb Instance C 20 Mb - Executing Instance A 20Mb – 1 Week Instance C 20 Mb - Executing Delay 1 week 2o kb SQL Database Before After
  • 24. When? Persist On Idle Persist On Command No Persist Zones Options? Persist Only Persist + Unload Where? SQL Custom Services - Persistence
  • 25. Allows the WF Engine to share/store information on the workflows. Storage is, by default, to SQL but can be anywhere. Uses: Real time monitoring Reviewing completed workflows For Bugs/supporting For KPI/Metrics For Auditing Services - Tracking
  • 26. Security Pack State Machine ADO.NET Migration Kit wf.codeplex.com

×