Fabio Carucci's WebLogs

"...You may say I'm a dreamer, but I'm not the only one..." (Imagine)
posts - 50, comments - 39, trackbacks - 7

My Links

News



PER CONSULENZE SCRIVERE SU "CONTACT"

Contattami se sono online!

This is my personal blog. These postings are provided "AS IS" with no warranties, and confer no rights. The views expressed on this weblog are mine alone and do not necessarily reflect the views of my employer.








View Fabio Carucci's profile on LinkedIn

Vuoi ricevere i miei post nella tua email? Iscriviti

Add to Technorati Favorites



http://www.csthota.com/blogmap/



Locations of visitors to this page





Tag Cloud

Archives

Post Categories

1 - Pubblicazioni

2 - Conferenze

3 - Links

4 - Blogs

L'arte di lavorare con Workflow Foundation - #1

Dopo aver definito e disegnato un workflow, lo poniamo in esecuzione. Immaginiamo di aver creato un workflow che ci permette di prendere le prenotazioni per mandare un nostro pony express in giro per la città a fare consegne.

Il nostro workflow tiene conto dell'orario di arrivo della richiesta, quindi gira al pony l'elenco, in ordine di arrivo, degli indirizzi a cui recarsi. Se volessimo rendere più ottimizzato il workflow potremmo inserire uno step intermedio (activity) che mette in ordine di vicinanza/lontananza gli indirizzi e fornisce una stima del tempo di arrivo del pony al cliente.

Il workflow è in esecuzione, ma grazie alla classe WorkflowChanges possiamo aggiungere a runtime la nuova activity senza dover interrompere nulla.

InvokeWorkflowActivity newWorkflow = new InvokeWorkflowActivity(); WorkflowChanges changes = new WorkflowChanges(this); Type type = typeof(ReservationWorkflow); newWorkflow.Name = "NewReservationWF"; newWorkflow.TargetWorkflow = type; DelayActivity delay = changes.TransientWorkflow.Activities["delay1"] as DelayActivity; delay.Parent.Activities.Add(newWorkflow); this.ApplyWorkflowChanges(changes);

Ci sono però delle restrizioni riguardo ai cambiamenti che possono essere compiuti su un workflow in esecuzione:

  • Le activities possono essere aggiunte o rimosse da un WF ma le proprietà di una attività esistente (regole escluse) non possono essere modificate;
  • Una activity composita non può avere al suo interno delle sotto-attività aggiunte o rimosse dinamicamente;
  • Una activity con una o più istanze nello stato di Executing, Fault, Canceling o Compensating non può essere rimossa da una istanza di un workflow in esecuzione.

Nei prossimi post scruteremo, con il passare del tempo sempre più in dettaglio, le numerose features di questo nuovo 'framework nel framework'.

Print | posted on giovedì 25 gennaio 2007 1.35 | Filed Under [ ASP.NET 2.0 Workflow Foundation ]

Feedback

No comments posted yet.

Post Comment

Title  
Name  
Email
Url
Comment   
Please add 1 and 6 and type the answer here:

Powered by: