diz que é uma espécie de extensibilidade do windows...

8
3/26/2007 6:04 PM MICROSOFT CONFIDENTIAL © 2006 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. 1 Diz que é uma espécie de Extensibilidade do Windows Workflow com custom activities Luis Calado [email protected] Technical Solution Professional Microsoft Corporation João “jota” Martins [email protected] CTO |create|it| Patrocinadores Sobre a sessão... Nível 300 Assume-se des conhecimento total e absoluto de Windows Workflow (WF) (bom, talvez a sessão do Nuno Antunes) (e conhecimento de .Net ) Objectivos Objectivos Perceber o que leva ao desenvolvimento de aplicações com workflow Pontos de extensibilidade no workflow Detalhes da criação de actividades Actividades? Para que servem Onde encaixam no modelo de workflow

Upload: others

Post on 03-Jul-2020

5 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Diz que é uma espécie de Extensibilidade do Windows ...download.microsoft.com/download/0/b/e/0be6834f-4fd... · Microsoft, Windows, Windows Vista and other product names are or

3/26/2007 6:04 PM

MICROSOFT CONFIDENTIAL© 2006 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. 1

Diz que é uma espécie de

Extensibilidade do Windows Workflow com custom activities

Luis [email protected] Solution ProfessionalMicrosoft Corporation

João “jota” [email protected]|create|it|

Patrocinadores

Sobre a sessão...

Nível 300

Assume-se desconhecimento total e absoluto de

Windows Workflow (WF)

(bom, talvez a sessão do Nuno Antunes)

(e conhecimento de .Net )

Objectivos

Objectivos

Perceber o que leva ao desenvolvimento de aplicações com workflow

Pontos de extensibilidade no workflow

Detalhes da criação de actividades

Actividades?

Para que servem

Onde encaixam no modelo de workflow

Page 2: Diz que é uma espécie de Extensibilidade do Windows ...download.microsoft.com/download/0/b/e/0be6834f-4fd... · Microsoft, Windows, Windows Vista and other product names are or

3/26/2007 6:04 PM

MICROSOFT CONFIDENTIAL© 2006 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. 2

Activity Library

Workflow Runtime

Engine

Runtime Services

Visual Studio Designer

Windows Workflow

Processos de Longa Duração

Flexibilidade

O que é um Workflow?

Implementação de processosou lógica de negócio

Qual o Valor do workflow?

Lançado em Nov/2006 como parte do Windows Vista/.Net 3.0

Transparência

Workflow

Host Process

Actividade

Porquê Custom Activities?

Os workflows WF são modelados como uma árvore de actividades, com uma ordem...

…por vezes as actividades existentes não são suficientes para realizar as acções pretendidas…

… e por forma a ter reutilização e isolamento de lógica aplicacional…

Então… Custom Activities

O que é uma actividade?É um passo do workflow, uma classe .Net

Tem propriedades e eventos, programados no código do workflow

Tem métodos que são apenas invocados pelo runtime do workflow (ex: Execute)

Um componente re-utilizável para compôr workflows

Analogia com User Interface: Forms e ControlsWorkflows == Forms

Actividade == Controls

Duas grandes categoriasBásicas – execução de tarefa (“do work”)

Compostas – contêm um conjunto de sub-actividades

Dependency PropertiesSuportam data binding declarativo

Disponibilizam metadados adicionais às propriedades

Estado é guardado internamente num dicionário do runtime do workflow

Execução do Workflow

Workflow

Actividade Actividade

Actividade

Actividade Actividade

Page 3: Diz que é uma espécie de Extensibilidade do Windows ...download.microsoft.com/download/0/b/e/0be6834f-4fd... · Microsoft, Windows, Windows Vista and other product names are or

3/26/2007 6:04 PM

MICROSOFT CONFIDENTIAL© 2006 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. 3

Biblioteca de actividades base

Actividades base disponibilizadas peloWF

Desenhadas para

Modelar e controlar o fluxo

Modelar comunicações

Exemplos

IfElse, Delay, While, State, etc.

InvokeWebService, CallExternalMethod, etc.

Construídas utilizando os mesmoscomponentes da API que são expostospara desenvolvimento

Quando escrever uma Custom Activity?

P/ executar, reutilizar, compôrlógica/funcionalidade

Lógica de negócio de alto nível

Integração e messaging

Modelar fluxos específicos

Actividades base e custom utilizama mesma framework base

Genéricas ou Específicas de um domínio

Exemplos de custom activities

SendEmail, FileSystemEvent, PurchaseOrderCreated, AssignTask, ForEach, etc.

Simplicidade

Flexibilidade

Formas de ter lógica de

execução n1 workflow

Actividades compostas

Actividades que contêm ouque podem conter sub-actividades

Qualquer actividade quederive de CompositeActivity

Workflows são na realidadeactividades compostas (!)

Cenários de actividadescompostas

Definir novos tipos de lógica de controlo de fluxo

Agrupar lógica do workflow emcomponentes re-utilizáveis

Estado de execução de uma actividade

Retornado pelo método Execute()

Acessível da actividade “pai” no workflowthis.Activity1.ExecutionStatus

Acompanhado por um Tracking Runtime Service

ActivityExecutionStatus EnumerationInitialized, Executing, Compensating, Cancelling, Faulting, Closed

Page 4: Diz que é uma espécie de Extensibilidade do Windows ...download.microsoft.com/download/0/b/e/0be6834f-4fd... · Microsoft, Windows, Windows Vista and other product names are or

3/26/2007 6:04 PM

MICROSOFT CONFIDENTIAL© 2006 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. 4

O que temos de fazer para desenvolver uma Custom Activity?

Derivar da classe base Activity (System.Workflow.ComponentModel)

Redefinir método Execute

Redefinir outros métodos ou atributosconforme apropriado 1. Criar uma custom activity

Máquina de estados da actividade

Initialized Executing Closed

Compensating

Faulting

Quem inicia a transição

Actividade (tracejado se final)

Workflow Runtime

Excepção na execução numa actividade

Canceling

MétodosInitialize()

Execute()

Cancel()

Compensate()

Modelo de ObjectosCada actividade tem um conjunto de componentes associados

Os componentes são associados através de atributos na suadefinição

Se não forem especificados são utilizados os definidos na super-classe

Obrigatório

Opcional (com defaults)

[Designer(typeof(MyDesigner))]

[ActivityCodeGenerator(typeof(MyCodeGen))]

[ActivityValidator(typeof(MyValidator))]

public class MyActivity: Activity {...}

Actividade

Code Generator

Designer

Validator

SerializerServiços

Workflow Runtime

Page 5: Diz que é uma espécie de Extensibilidade do Windows ...download.microsoft.com/download/0/b/e/0be6834f-4fd... · Microsoft, Windows, Windows Vista and other product names are or

3/26/2007 6:04 PM

MICROSOFT CONFIDENTIAL© 2006 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. 5

2. Adicionar um Validador e uns Designers

Adicionar propriedades a uma Custom Activity

Devem ser utilizadas Dependency Properties

Mais eficiente durante o desenho e o runtime da actividade

Suporte para Data Binding

Validação

Integração com o Designer

Serialização mais eficiente

Dependency Properties

Conjunto de D.P’s são um repositório centralizado do estado de um workflow

Valores são guardados pela classe base (DependencyObject) numa hash table

Static fields disponibilizam declaração de metadados de propriedades

Data Binding

Permite que propriedades de umaactividade sejam “bound” a propriedadesde outra

Permite a movimentação de dados entre actividades sem ter que existir partilha de informação dos respectivos tipos

Designer disponibiliza binding dialog

Page 6: Diz que é uma espécie de Extensibilidade do Windows ...download.microsoft.com/download/0/b/e/0be6834f-4fd... · Microsoft, Windows, Windows Vista and other product names are or

3/26/2007 6:04 PM

MICROSOFT CONFIDENTIAL© 2006 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. 6

Promoção de propriedades

Sub-actividades em qualquer profundidadepodem ter as suas propriedades expostasna actividade composta que as agrega

Permite às actividades receber valores queafectam a forma como estas vão executarsem que as mesmas tenham que expôr a sua lógica

Suportado através do Custom Activity Designer

3. Utilização de Custom Activities

Execução típica de umaactividade composta

Composite Activity

..

..

..

+= OnChildClosed

+= OnChildClosed

Execute()

Status.Closed()

Child

Activity

Child

Activity

Sumário

Workflows são construídos como árvores de actividades

Benefícios de desenvolver c/ o modelo de Actividades do WF

Transparência

Serviços

Modificação dinâmica

Actividades são a unidade fundamental de:

Execução, Re-utilização, Composição

Dois grandes tipos de actividades:

Básicas & Compostas

Desenvolver custom activities! Go-Go-Go!

Page 7: Diz que é uma espécie de Extensibilidade do Windows ...download.microsoft.com/download/0/b/e/0be6834f-4fd... · Microsoft, Windows, Windows Vista and other product names are or

3/26/2007 6:04 PM

MICROSOFT CONFIDENTIAL© 2006 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. 7

• Ships with Visual

Studio “Orcas”

• Ships with Windows Server “Longhorn”

• Builds on 3.0 for

100% compatibility

• Adds some features

representing top customer requests

• Example: WCF to

WF integration

• CTP in Feb 2007

with “Orcas” CTP

• Released Nov 2006

• Windows Vista ,

Windows XP SP2, Windows Server

2003 SP1

• Released tools for

Visual Studio 2005

• Top customer

requests

• Continues to be the managed code

developer platform

for Windows

• Platform for

BizTalk Server vNext

• ~2009

.NET Framework 3.0 .NET Framework 3.5 .NET Framework 4.0

Roadmap .NET Framework Recursos

•Site “oficial” comunidadewf.netfx3.com

•Fóruns//forums.microsoft.com/MSDN/ShowForum.aspx?F

orumID=122&SiteID=1

•Workflow Performance//msdn2.microsoft.com/en-us/library/Aa973808.aspx

•MSDN UK Nuggets//www.microsoft.com/uk/msdn/events/nuggets.aspx

•MSDN Library Whitepapersmsdn.microsoft.com/workflow

•Blog Paul Andrewblogs.msdn.com/pandrew/

PAE/Pergunte aos“Especialistas”Obtenha Respostas às Suas Questões

Na banca de Arquitectura

... quando me virem por aí, ou por mail: [email protected]

Page 8: Diz que é uma espécie de Extensibilidade do Windows ...download.microsoft.com/download/0/b/e/0be6834f-4fd... · Microsoft, Windows, Windows Vista and other product names are or

3/26/2007 6:04 PM

MICROSOFT CONFIDENTIAL© 2006 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. 8

Outros RecursosPara Profissionais de TI

TechNet Plus2 incidentes de suporte gratuito profissional

software exclusivo: Capacity Planner

software Microsoft para avaliação

actualizações de segurança e service packs

acesso privilegiado à knowledge base

formação gratuita

e muito mais.

www.microsoft.com/portugal/technet/subscricoes

Questionário de AvaliaçãoPassatempo!

Complete o questionário de avaliação e devolva-o no balcão da recepção.

Habilite-se a ganhar uma Xbox 360 por dia!

DEV020

Extensibilidade do WF com Custom Activities

© 2007 Microsoft Corporation. All rights reserved.This presentation is for informational purposes only. Microsoft makes no w arranties, express or implied, in this summary.