1 / 29

Building Activities to Leverage the Power of Windows Workflow Foundation in .NET Framework 4

Required Slide. SESSION CODE: ASI303. Building Activities to Leverage the Power of Windows Workflow Foundation in .NET Framework 4. m att winkler p rogram manager m icrosoft corporation http://blogs.msdn.com/mwinkle. Agenda. Activities 101 Base types Activity Composition

hateya
Télécharger la présentation

Building Activities to Leverage the Power of Windows Workflow Foundation in .NET Framework 4

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Required Slide SESSION CODE: ASI303 Building Activities to Leverage the Power of Windows Workflow Foundation in .NET Framework 4 matt winkler program manager microsoftcorporation http://blogs.msdn.com/mwinkle

  2. Agenda • Activities 101 • Base types • Activity Composition • Code Activity • Activities 102 • Native Activities • ActivityDelegate • Expressions as Activities • Activity Designers

  3. Goals When you leave this talk, you should… • Understand the activity programming model • Know when to use which base type • Create custom control flow activities to encapsulate execution logic • Use advanced activity features like ActivityDelegate and Activities as Expressions • Construct a visual experience for users of your activities • Leverage activities for fun and profit!

  4. Non Goals • Out of the box activities • Migrating WF3 => WF4 • Consuming / Hosting WCF Services • Persistence Extensibility

  5. Activities 101 Activity Basics, Base Classes, Activity Composition, CodeActivity

  6. Activities 101 • Activities are the unit of work for WF • Activities = Data + Work • Data • Arguments – Shape • Variables – Storage • Work • Code you write • Code Microsoft wrote (Out of the box activities) • Other activities

  7. Type Hierarchy CodeActivity AsyncCodeActivity Activity ActivityWithResult NativeActivity DynamicActivity

  8. Activity Composition • Compose a new type out of existing activities • Purely declarative • Compile, or execute directly via DynamicActivity • Use when: • You are creating an additional level of abstraction • Creating an element of reuse • Don’t use when: • You work against the grain (write custom composite first)

  9. CodeActivity • Extending WF by creating your own atoms of execution • Inherit from CodeActivity, override .Execute() • Use When: • You have existing methods you want to easily encapsulate • Quickly create a custom activity with a little bit of code • Don’t use when: • You need to schedule other activities (use NativeActivity) • Be careful about: • Blocking the execution thread (use AsyncCodeActivity)

  10. Activity Basics Creating a composed activity, via code and designer Execute with DynamicActivity Creating a CodeActivity Doing asynchronous, parallel work with AsyncCodeActivity DEMO

  11. Activities 102 NativeActivity, ActivityDelegate, Expressions, Designers

  12. NativeActivity • “lowest level” activity authoring model • Provides greatest degree of control and extensibility • Use when: • You need to directly interact with the WF Runtime • You write a custom composite • You want to create a bookmark for a resumption point • Don’t use when: • You just want to write some code in Execute (use CodeActivity to compute π) • Be careful about: • Handling error conditions, cancellation • Explicit vs implicit child management

  13. Execution Model • Multiple activity instances per activity definition • *Context resolves to the instance • Hence the theArgument.Get(context) syntax • Extensions provide access to host provided functionality • Interesting implications • Variables can be scoped • “Normal” properties become static across all instances of the activity

  14. NativeActivity Intro to bookmarks Writing control flow activities Using Extensions Understanding Argument Evaluation DEMO

  15. Swiss Cheese Activities, or, Using ActivityDelegate • Allow consumers to plug in their own functionality • Equivalent to a property of Func, Action or Predicate on a traditional type • Use when: • Want to create a schematized placeholder for some work • Consumers can customize parts of the activity execution • Don’t use when: • Schematization not required (just write a composite) • Be careful about: • Syntax to pass values • Need to create a designer Approval Payment Process Order Receive Order Reserve Inventory Ship Order background info

  16. ActivityDelegate Basic ActivityAction usage Intro to ActivityFunc DEMO

  17. Expressions As Activities • A common pattern of activities has a single return value • ActivityWithResult, and more commonly, Activity<Tresult>, has a .Result OutArgument • Compose directly into InArguments • Use when: • Activity is more functional, that is, it does work on a set of inputs and has one well defined output • Don’t use when: • Be careful about: • No native designer experience • Side effects that may rely on evaluation order

  18. Expressions As Activities Continuing with ActivityFunc Creating Activity<T> DEMO

  19. Building Activity Designers • Customize the visualization of activities • Use when: • You want to display some properties on canvas • Child elements to display • Create a different experience in a rehosted designer • Don’t use when: • You don’t think you need it (the default works well for many leaf activities) • Be careful about: • Expecting to get values out of Arguments (they resolve at runtime)

  20. Building Activity Designers Surface key data Display contained elements ExpressionTextBox WorkflowItemPresenter WorkflowItemsPresenter

  21. Building Activity Designers Walkthrough of basic types & usage Creating a rehosting app as a test harness Creating an activity designer and using in Visual Studio DEMO

  22. Conclusion • Activities = Data + Work • Activities provide • A way to model the work that you want to orchestrate • A simple model to compose, encapsulate and reuse work • Ways to add long-running-ness, trackability, and other interesting aspects into your programs • A mechanism to allow for customization via Activity Delegate • A customizable view to help your customers compose workflows • WRITE ACTIVITIES!!!

  23. A Quick Request • If you’re interested in State Machine, let me know, we’d like to get some feedback from you

  24. Required Slide Track PMs will supply the content for this slide, which will be inserted during the final scrub. ASI Track Resources • Website – www.Microsoft.com/WindowsAzure/AppFabric • MSDN Developer Center – http://msdn.microsoft.com/en-us/azure/netservices.aspx • Blog – http://blogs.msdn.com/b/netservices/ • Twitter – http://twitter.com/azure_appfabric • Website – http://www.microsoft.com/biztalk/ • Website – http://msdn.microsoft.com/biztalk/ • Blog – http://blogs.msdn.com/biztalk_server_team_blog • Blog – http://www.biztalkblogs.com/ • Application Infrastructure Virtual Launch Event – www.appinfrastructure.com • AppFabric on Microsoft.com – http://www.microsoft.com/appfabric • Developer Center – http://msdn.microsoft.com/appfabric

  25. Required Slide Resources Learning • Sessions On-Demand & Community • Microsoft Certification & Training Resources www.microsoft.com/teched www.microsoft.com/learning • Resources for IT Professionals • Resources for Developers • http://microsoft.com/technet • http://microsoft.com/msdn

  26. Required Slide Complete an evaluation on CommNet and enter to win!

  27. Sign up for Tech·Ed 2011 and save $500 starting June 8 – June 31st http://northamerica.msteched.com/registration You can also register at the North America 2011 kiosk located at registrationJoin us in Atlanta next year

  28. © 2010 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.

  29. Required Slide

More Related