Windows Workflow Foundation .net Core

1 view
Skip to first unread message

Patricia

unread,
Aug 5, 2024, 11:40:14 AM8/5/24
to herrovestni
Myname is Dustin Metzger I used to work for Microsoft I was on the .NET Framework team kind of in and out for about almost 10 years. And when I started, they were just getting ready to ship .NET 4. And before Microsoft, I had worked for a bunch of different companies that actually had, had been using.net framework. I was using Workflow in one of those companies.

And then I was really interested actually went for an interview with Microsoft and got accepted into the into the workflow team. And I was kind of working on performance and actually set up for quite a while and then moved around, did some Azure services and actually came back to workflow and ended up running the the Workflow team, at least what was left of it. I had a team of about 10 people and we were supporting workflows on the .NET Framework ,also System.Transactions, which is includes that like TransactionScope, which was introduced in .NET Framework 2.0. That was ported into .NET Core, and then my team supported that as well. We had made an attempt to port, the Workflow Foundation over to NET Core, but ran into some roadblocks.


The book is actually part of, like a set of four books, so Entity Framework Core in Action, ASP.NET Core in Action, and Xamarin in Action all fit together with my book, my books kind of like the lower level, the foundational part of what is .NET Core? What is .NET Standard? and then EF, and ASP.NET, and Xamarin are all kind of branching out from there. Although Xamarin was a bit earlier, and I think that book was already being built before mine was being written, so.


That was my interview with Dustin Metzgar. Be sure to check out the show notes for a bunch of links to some of the stuff that we covered, and a full transcription of the interview. The show notes, as always, can be found at dotnetcore.show.


Windows Workflow Foundation (WF) is a framework technology which provides a level of abstraction for developing workflow based applications. Windows Workflow provides the core functionality you would need in a workflow such as flow control, persistence of workflow state, error management and instance management.


I addition to these core concepts of a workflows runtime requirements WF also provides an activity which is a unit of work which you can implement with out of the box activities or extension to your own custom requirements.


WF can be used directly by your own code to implement custom workflows or you could be using WF in directly within a product such as SharePoint or Dynamics CRM which lets you build something like a SharePoint workflow which under the hood use the WF framework.


The workflow runtime is the runtime engine under which the WF workflow will execute. The runtime provides access to some of the features mentioned below but the runtime requires something to host it which can be your own code or an application such as SharePoint. The Workflow Runtime contains a class called WorkflowServiceHost which is the one which you would use to self host the runtime inside something like a Windows Service or custom application.


Within the Workflow Runtime there are features which support persistence of the workflow. This means that when a workflow is to perform certain activities the state can be saved so there is a known recovery point the workflow can be returned to in the case of an error.


Correlation is a way to relate a message and a workflow instance. This is important when interacting with applications outside of the workflow so that a message is able to be returned to the correct workflow instance.


Messaging Activities

Messaging Activities allow your to send and receive WCF messages in a workflow. This allows your workflow to interact with services outside of the workflow or to expose an endpoint that an application can use to make a call to your workflow.


In .net 4.5 the WF runtime has introduced support for side-by-side versioning of workflows within a host. This means any in flight workflows can continue to work against the older versions of code after a new deployment of an updated workflow.


The key strength of WF is that Microsoft is eating its own dog food and using WF as a core part of some of its most important products such as Sharepoint, Office 365, Dynamics CRM and its also into Azure BizTalk Services. This should give WF a strong future and some good investment. The fact that WF can be used at a higher abstraction layer in these products makes WF easier to use and more reliable than when you have to do the plumbing work your self when self hosting it.


In addition to this Windows Workflow Manager is now being used by a lot of these products internally hot the hosting of Workflow and this is also something that you can use yourself to solve the problem of the Enterprise Host if you want to run Workflow for your self.


WF itself is free and part of the core .net framework. However be aware of the dependencies section above which may mean to deliver a WF based solution you need other supporting technologies which may have a cost associated with them.


Really a more likely comparison is that WF would be comparable to the underlying framework that Logic Apps and Flow use to implement their workflows. A bit like comparing a finished car with a car chassis.


BizTalk offers a feature called orchestration based on the XLANG framework in BizTalk. This is a more constrained workflow framework which is specific to BizTalk Server and is specific around working with the BizTalk message box. From an integration architects perspective there can be some confusion between the overlap of WF and BizTalk Orchestration. The key difference is that BizTalk provides a whole bunch of other features for integration solutions and using a BizTalk orchestration within that context is fine. WF offers a more open workflow framework which can be used for any kind of workflow scenario not just for integration, but WF does not have the other features which BizTalk offers which integration needs.


I think creating Service Based solutions where a business workflow was hosted in WF and could be called by BizTalk when it is making the transition from an EAI piece of work to a service based piece of work would be a good way to combine the use of these two products.


AppFabric contains a WF hosting feature. This was used by some customers but has been superseeded by Workflow Manager. If you are starting a new project today with WF then Workflow Manager should be the place to look for self hosting options rather than AppFabric.


I believe that WF is a technology that is pretty niche today. Some vendors (inc Microsoft) have used this under the hood in their products with plenty of success but there is a strong trend of those who have used WF in this manner to be looking to move away from WF to things like Flow and Logic Apps today. We can see examples of this in Dynamics and SharePoint.


I would also say at this stage WF is tied to the lifecycle of .net Framework. You are fine for quite a long time in terms of support for .net Framework including WF but some organisations will be migrating some services to .net core. Its not clear if .net core will include WF at this stage


Windows WorkFlow Foundation is one of the core components of the WinFX .NET Framework wave from Microsoft. It provides a singular engine to ensure the workflow execution for all Microsoft applications in the Windows platform. The Foundation consists of a set of tools to enable programmers and users to create workflows; the working engine and the Object Model that permit developers to interact programmatically with the system.


Developing a WorkFlow in Visual Studio is equally effortless as developing an aspx or Windows application: select Activities from the provided Base Activity Library (BAL) that includes a number of fundamental activities, connect them, and write the specified code. This works in the same way as selecting and adding Web or Windows controls. Visual Studio 2005 provides a graphic tool (the WorkFlow Designer) that allows you to define graphically the shape of the WorkFlow, the participant activities and the order of execution. Figure 1 shows a Sequential WorkFlow in the Visual Studio 2005 Designer (central panel), the Tools Panel with the Activities Library (left panel) and the project and properties panels (on the right side).


A typical WorkFlow paradigm begins with an initialization situation, which in this case is a decisions branch (IfElseBranchActivity). The relatively simple example WorkFlow follows an approval process of a document to be published. The initial condition determines if the document concerned pursues a Refusal or a Publishing process (Editorial_Work/Publication_Queue/Publication) and finally, the conclusion of the WorkFlow is a notification to the author.


The ifElseBranchActivity needs a definition for the condition (therefore the exclamation red mark). The Designer offers a special window to define the condition where IntelliSense and Code Completion are activated. This is shown in Figure 2.


It also is possible to define a method in the code-behind (that returns true or false) to be connected to the condition branch. In this case, first it is necessary to define the method in code, and thereafter the Code Completion will indicate the method to be selected.


Each WorkFlow needs a Host to reside in, as explained in Part I. For the sample WorkFlow, you can use a Windows application that initializes the process, sets the required properties and, eventually, displays the resultant status.


Note: Because this is a test program, there are no validations for the input or other kinds of code to prevent failures. The first step is set references to the following: System.Workflow.Activities, System.Workflow.ComponentModel, and System.Workflow.Runtime namespaces, making it possible to work with the Object Model of the WorkFlow Foundation. Additionally, a reference must be set to the newly created WorkFlow assembly that will be initialized and used in the code.


Note: For test purposes, the methods of the WorkFlow have been changed to write the status of the Activities to a text file. The WebService is also modified in the same way. From this site the source code for all components can be downloaded.*

3a8082e126
Reply all
Reply to author
Forward
0 new messages