Matt Winkler – Technical Evangelist WF Microsoft Corporation CON312.

Slides:



Advertisements
Similar presentations
© 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
Advertisements

© 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or.
Feature: Identity Management - Login © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or.
© 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or.
© 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or.
© 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or.
© 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
Feature: Reprint Outstanding Transactions Report © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product.
Feature: Purchase Requisitions - Requester © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names.
MIX 09 4/15/ :14 PM © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
Co- location Mass Market Managed Hosting ISV Hosting.
© 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or.
Windows 7 Training Microsoft Confidential. Windows ® 7 Compatibility Version Checking.
Multitenant Model Request/Response General Model.
Feature: Purchase Order Prepayments II © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are.
Feature: OLE Notes Migration Utility
Feature: Web Client Keyboard Shortcuts © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are.
Feature: SmartList Usability Enhancements © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names.
1 Developing Rules Driven Workflows in Windows Workflow Foundation Jurgen Willis COM318 Program Manager Microsoft Corporation.
Session 1.
travel Suru Windows 7 Release NET 4.0 / Surface 2.0 Release Multi-Touch Controls Multi-Touch API Surface Multi-Touch Controls & API Surface.
Built by Developers for Developers…. © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names.
 Rico Mariani Architect Microsoft Corporation.
© 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or.
Feature: Assign an Item to Multiple Sites © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names.
© 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or.
Feature: Print Remaining Documents © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or.
Connect with life Connect with life
WEB 304 An Overview of ASP.NET and Windows Workflow Foundation Kashif Alam Program Manager Developer Division Microsoft Corporation.
NEXT: Overview – Sharing skills & code.
demo Receive Inventory Export Parse and Normalize.
© 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or.
Feature: Document Attachment –Replace OLE Notes © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product.
Feature: Suggested Item Enhancements – Sales Script and Additional Information © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows.
Feature: Customer Combiner and Modifier © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are.
Feature: Employee Self Service Timecard Entry © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names.
Ian Ellison-Taylor General Manager Microsoft Corporation PC27.
© 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or.
demo Instance AInstance B Read “7” Write “8”

customer.
demo © 2008 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names.
demo Demo.
Feature: Void Historical/Open Transaction Updates © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product.
demo QueryForeign KeyInstance /sm:body()/x:Order/x:Delivery/y:TrackingId1Z
Feature: Suggested Item Enhancements – Analysis and Assignment © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and.
projekt202 © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are.
The CLR CoreCLRCoreCLR © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product.
© 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks.
© 2008 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or.

IoCompleteRequest (Irp);... p = NULL; …f(p);
Ctrl-K, X Ctrl-K, S
Возможности Excel 2010, о которых следует знать
Title of Presentation 11/22/2018 3:34 PM
Title of Presentation 12/2/2018 3:48 PM
Brian Keller Sr. Technical Evangelist Microsoft Session Code: DEV310
Building event-driven, long-running apps with Windows workflow
Introduction to Windows Workflow Foundation (WF)
Brian Keller Sr. Technical Evangelist Microsoft Session Code: DEV310
8/04/2019 9:13 PM © 2006 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
Виктор Хаджийски Катедра “Металургия на желязото и металолеене”
PENSACOLA ENERGY WORK PLAN OCTOBER 10, 2016
Title of Presentation 5/12/ :53 PM
Шитманов Дархан Қаражанұлы Тарих пәнінің
Title of Presentation 5/24/2019 1:26 PM
日本初公開!? Vista の新機能を実演 とっちゃん わんくま同盟 7/23/2019 9:09 AM
Title of Presentation 7/24/2019 8:53 PM
Presentation transcript:

Matt Winkler – Technical Evangelist WF Microsoft Corporation CON312

Introduction Rule execution Rule extensibility

Activity Library Workflow Runtime Engine Runtime Services Visual Studio Designer Long Running Logic Flexibility What is Workflow? Workflow is the software implementation of business process or business logic What’s the value of Workflow? Released Nov 2006 as a part of Windows Vista Transparency A Workflow Host Process Activity

Conditions Boolean expressions Rule If Condition THEN ELSE RuleSet Collection of rules Execution semantics

Simple semantics for defining discrete, atomic rules Aggregation of rules into rule sets that represent rich application behavior Modeling Power Declarative nature allows domain experts to concentrate on the business requirements Model-driven design allows for rich authoring and management tools Externalization of rule logic from application code Rapid deployment model Supporting impact analysis and simulation capabilities Approachability Ease of Change

Externalize decision details from process Create tooling for rule customization by non- developers Execute a set of rules against a set of facts Take advantage of complex execution semantics that are nearly impossible to model in code

Activity Conditions If-Else While Replicator Conditioned Activity Group (CAG) Conditions on Custom Activities Policy Activity Encapsulates the definition and execution of a RuleSet Custom Activities.NET Applications

Code conditions Fast, fast, fast Compiled into workflow Declarative conditions Externalized in.rules file Compiled into workflow, but easy to change

Versioning and Management Independent from the application Specialized management tools for rules Deployment and Compilation Ease of change No application recompilation Rules only deployment / No application redeployment

Use declarative, XAML-only workflows public WorkflowInstance CreateWorkflow( XmlReader workflowDefinitionReader, XmlReader rulesReader, Dictionary namedArgumentValues)

Use DynamicUpdate static void UpdateRules(WorkflowInstance instance) { WorkflowMarkupSerializer serializer = new WorkflowMarkupSerializer(); XmlTextReader reader = new XmlTextReader("..\\RealRules.rules"); RuleDefinitions rules = serializer.Deserialize(reader) as RuleDefinitions; WorkflowChanges changes = new WorkflowChanges( instance.GetWorkflowDefinition()); changes.TransientWorkflow.SetValue( RuleDefinitions.RuleDefinitionsProperty, rules); instance.ApplyWorkflowChanges(changes); }

Write a custom loader workflowRuntime.AddService(new CustomLoader()); class CustomLoader : DefaultWorkflowLoaderService { protected override Activity CreateInstance(Type workflowType) { Activity workflow = base.CreateInstance(workflowType); WorkflowMarkupSerializer serializer = new WorkflowMarkupSerializer(); XmlTextReader reader = new XmlTextReader("..\\RealRules.rules"); RuleDefinitions rules = serializer.Deserialize(reader) as RuleDefinitions; workflow.SetValue(RuleDefinitions.RuleDefinitionsProperty, rules); return workflow; }

Create rules service RuleSet Designer RuleSet Designer RuleSet Repository RuleSet Repository Host RuleSet Service Workflow1 Workflow2 Workflow3 Custom Policy Activity Custom Policy Activity Custom Policy Activity Custom Policy Activity Custom Policy Activity Custom Policy Activity

Option 1: Explicit Pattern Option2: Custom Loader Option 3: WorkflowChanges Option 4: CreateWF overload Outside WF YESNO When are the rules loaded? When policy activity executes When WF is loaded (initial, re- hydrated) When DynamicUpdates are made When instance is created Workflows with code- beside YES NO

RuleSetDialog ruleSetDialog = new RuleSetDialog(targetType, ruleSet); DialogResult result = ruleSetDialog.ShowDialog(); RuleSet newRuleSet = ruleSetDialog.RuleSet; Host RuleSet Editor WorkflowMarkupSerializer.Serialize(XmlWriter writer, object obj); Serialize Workflow Add RuleSetService to WorkflowRuntime WorkflowRuntime.AddService(new RuleSetService());

RuleValidation validation = new RuleValidation(targetObject.GetType(), null); RuleExecution execution = new RuleExecution(validation, targetObject, null); ruleSet.Execute(execution); Execute RuleSet ValidationErrorsCollection errors = validation.Errors; Validation Errors

Rulesets can get very big, (10,000+ rules) The rules engine tracks changes (side effects) of rule execution to enable rule re- execution We have fine grained control over execution Priority Chaining mechanisms Implicit Explicit “Partially Explicit”

Amount = $25 Total = $80 Discount = 10% Rule 1 (P0) If Total > $50 & < $100 Then Discount = 10% Rule 2 (P0) If Total >= $100 Then Discount = 15% Rule 3 (P0) If Amount > $0 Then Total = Total + Amount Rule 1 Rule 3 Rule 2 Execution Sequence $105 RuleSet 15%

Declaratively decorate methods in a class to allow rule engine to infer chaining behavior [RuleRead(path)] Indicate decorated method relies on variable in path [RuleWrite(path)] Indicate decorated method updates variable in path [RuleInvoke(methodName)] Indicate decorated method calls another method which updates a variable

Rule 1 (Priority =2) If 1==1 Then this.enumerator = this.collection.GetEnumerator() Rule 2 (Priority = 1) If this.enumerator.MoveNext() Then this.currentInstance = this.enumerator.Current Rules 3 – n (Priority = 0) // write these against currentInstance Rule n+1 (Priority = -1) If this.currentInstance == this.currentInstance Then Update(this/enumerator)

InRule TM for Windows® Workflow Foundation

RuleDefinitionsRuleSet 1 * Rule 1 * RuleSetReference -RuleSetName * -Name 1 Activity 11 RuleCondition RuleExpressionCondition CodeExpression RuleAction RuleStatementAction RuleHaltActionRuleUpdateAction CodeStatement

CodeArrayIndexerExpression CodeAssignStatement CodeBinaryOperatorExpression CodeCastExpression CodeDirectionExpression CodeExpressionStatement CodeFieldReferenceExpression CodeIndexerExpression CodeMethodInvokeExpression CodeMethodReferenceExpressio n CodePrimitiveExpression CodePropertyReferenceExpressi on CodeThisReferenceExpression CodeTypeReference CodeTypeReferenceExpression CodeObjectCreateExpression * CodeArrayCreateExpression * * New in NETFX 3.5

Re-use/share commonly used expressions and actions Choose text representation in the Rules editor Can participate in RuleSet validation and raise errors Can participate in the forward chaining analysis Access to ActivityExecutionContext (access to the running activities, host services, etc.) Raises the authoring semantic

Derives from CodeExpression Implements IRuleExpression public interface IRuleExpression { void AnalyzeUsage(RuleAnalysis analysis, bool isRead, bool isWritten, RulePathQualifier qualifier); CodeExpression Clone(); void Decompile(StringBuilder stringBuilder, CodeExpression parentExpression); RuleExpressionResult Evaluate(RuleExecution execution); bool Match(CodeExpression expression); RuleExpressionInfo Validate(RuleValidation validation, bool isWritten); }

Derives from RuleAction [Serializable] public abstract class RuleAction { public abstract RuleAction Clone(); public abstract void Execute(RuleExecution context); public abstract ICollection GetSideEffects(RuleValidation validation); public abstract bool Validate(RuleValidation validator); }

Given a rule action has access to ActivityExecutionInstance, we could schedule an activity to execute Gain the ability to model rule actions as activities (or a sequence of activities) Lose the ability to react to side effects from activity execution (chaining), but could re-run ruleset

Rules are an easy way to add flexible logic to your process Rules can be used stand-alone by any.NET application Management and tooling can be built on top of the rule API’s Custom actions and expressions make it easier to expose functionality to ruleset designers

© 2007 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.