24
Declarative Services in .NET 4.0 Alan Smith SDC 2010 – 16 th March 2010

Declarative Services in.NET 4.0 Alan Smith SDC 2010 – 16 th March 2010

  • View
    213

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Declarative Services in.NET 4.0 Alan Smith SDC 2010 – 16 th March 2010

Declarative Services in .NET 4.0Alan Smith

SDC 2010 – 16th March 2010

Page 2: Declarative Services in.NET 4.0 Alan Smith SDC 2010 – 16 th March 2010

Alan Smith

• Developer, Trainer, Mentor, Evangelist– Know IT Consulting

• “Connected Systems Developer” MVP• Microsoft “Connected Technology Advisor”• Contact:– www.CloudCasts.net– geekswithblogs.net/asmith– [email protected]

Page 3: Declarative Services in.NET 4.0 Alan Smith SDC 2010 – 16 th March 2010

.NET 4.0 at your Service

• Windows Communication Foundation (WCF)– Simplified Configuration– WS-Discovery– Routing Service– Improved REST support

Page 4: Declarative Services in.NET 4.0 Alan Smith SDC 2010 – 16 th March 2010

.NET 4.0 at your Service

• Windows Workflow Foundation (WF)– New workflow runtime– New workflow designer– New activity model– New WCF integration capabilities

Page 5: Declarative Services in.NET 4.0 Alan Smith SDC 2010 – 16 th March 2010

.NET 4.0 at your Service

• WCF Workflow Services– Workflow designer used to create WCF services– Workflow exposed through WCF endpoint– Powerful integration with WCF– One of many uses for WF

Page 6: Declarative Services in.NET 4.0 Alan Smith SDC 2010 – 16 th March 2010

.NET 4.0 at your Service

• Windows Server AppFabric Application Server Extensions (AppFabric)– Formally “Codename Dublin”– Enhanced WCF and WF hosting capabilities– Workflow persistence– Workflow and service management– Distributed in-memory cache (formally

“Codename Velocity”)

Page 7: Declarative Services in.NET 4.0 Alan Smith SDC 2010 – 16 th March 2010

Workflow Service ConceptsConcept Description

Declarative Service implementation is declared using XAML

Persistent State of workflow can be serialized to data store

Long-Running Service lifetime can be longer than first call duration

Durable Service instances can survive host restarts

Page 8: Declarative Services in.NET 4.0 Alan Smith SDC 2010 – 16 th March 2010

Classic WCF Service• Client can call methods in any

order• Service is instanced on per-call

basis• Order state is maintained in LOB

Database

[ServiceContract(Name = "OrderManagement")]public interface IOrderManagement{ [OperationContract] void RegisterOrder(Order newOrder);  [OperationContract] void ConfirmOrder(Order newOrder);  [OperationContract] void CancelOrder(Order newOrder); }

Page 9: Declarative Services in.NET 4.0 Alan Smith SDC 2010 – 16 th March 2010

Classic WCF Implementation

Warehouse Database

AppFabric

Order Manager Service

Client

RegisterRegisterId = 123Id = 123

OrderID State

RegisterRegisterId = 456Id = 456ConformConformId = 123Id = 123RegisterRegisterId = 789Id = 789CancelCancel

Id = 789Id = 789ConfirmConfirmId = 456Id = 456

OrderID State

123 Registered

OrderID State

123 Registered

456 Registered

OrderID State

123 Confirmed

456 Registered

OrderID State

123 Confirmed

456 Registered

789 Registered

OrderID State

123 Confirmed

456 Registered

789 Cancelled

OrderID State

123 Confirmed

456 Confirmed

789 Cancelled

Page 10: Declarative Services in.NET 4.0 Alan Smith SDC 2010 – 16 th March 2010

Stateful Services – Classic WCF

• Client maintains session with service– Secure session– Reliable session– Transport session

• Service instancing configured appropriately– Per call– Per session– Single

Page 11: Declarative Services in.NET 4.0 Alan Smith SDC 2010 – 16 th March 2010

WCF Workflow Service• RegisterOrder creates workflow

instance• Order state is maintained in

workflow instance• ConformOrder or CancelOrder is

then called• Correlation needed between

service calls

Page 12: Declarative Services in.NET 4.0 Alan Smith SDC 2010 – 16 th March 2010

Register (123)

AppFabric Persistence Database

AppFabric

Order Manager Service

Client

RegisterRegisterId = 123Id = 123

ConfirConfirmm

CanceCancell

123123

ConfirConfirmm

CanceCancell

123123

Page 13: Declarative Services in.NET 4.0 Alan Smith SDC 2010 – 16 th March 2010

Register (456)

AppFabric Persistence Database

AppFabric

Order Manager Service

Client

RegisterRegisterId = 456Id = 456

ConfirConfirmm

CanceCancell

456456

ConfirConfirmm

CanceCancell

123123

ConfirConfirmm

CanceCancell

456456

Page 14: Declarative Services in.NET 4.0 Alan Smith SDC 2010 – 16 th March 2010

AppFabric Persistence Database

ConfirConfirmm

CanceCancell

123123

Confirm (123)AppFabric

Order Manager Service

Client

ConformConformId = 123Id = 123

ConfirConfirmm

CanceCancell

123123

ConfirConfirmm

CanceCancell

123123

ConfirConfirmm

CanceCancell

456456

ConfirConfirmm

CanceCancell

123123

Page 15: Declarative Services in.NET 4.0 Alan Smith SDC 2010 – 16 th March 2010

Register (789)

AppFabric Persistence Database

AppFabric

Order Manager Service

Client

RegisterRegisterId = 789Id = 789

ConfirConfirmm

CanceCancell

789789

ConfirConfirmm

CanceCancell

123123

ConfirConfirmm

CanceCancell

456456

ConfirConfirmm

CanceCancell

789789

Page 16: Declarative Services in.NET 4.0 Alan Smith SDC 2010 – 16 th March 2010

AppFabric Persistence Database

ConfirConfirmm

CanceCancell

789789

Cancel (789)AppFabric

Order Manager Service

Client

CancelCancelId = 789Id = 789

ConfirConfirmm

CanceCancell

789789

ConfirConfirmm

CanceCancell

789789

ConfirConfirmm

CanceCancell

456456

ConfirConfirmm

CanceCancell

123123

ConfirConfirmm

CanceCancell

789789

Page 17: Declarative Services in.NET 4.0 Alan Smith SDC 2010 – 16 th March 2010

AppFabric Persistence Database

ConfirConfirmm

CanceCancell

456456

Confirm (456)AppFabric

Order Manager Service

Client

ConfirmConfirmId = 456Id = 456

ConfirConfirmm

CanceCancell

456456

ConfirConfirmm

CanceCancell

456456

ConfirConfirmm

CanceCancell

456456

ConfirConfirmm

CanceCancell

123123

ConfirConfirmm

CanceCancell

789789

Page 18: Declarative Services in.NET 4.0 Alan Smith SDC 2010 – 16 th March 2010

Demo…

Page 19: Declarative Services in.NET 4.0 Alan Smith SDC 2010 – 16 th March 2010

IIS Manager

AppFabric Hosting ArchitectureVisual Studio

System Centre

IIS / WAS

App Fabric Tools

Runtime Services & Components

Persistence Hosting Monitoring

ASP.NET

WCF ETWWF

SQL Server

Monitoring Persistence

PowerShell

App Cmdlets

Page 20: Declarative Services in.NET 4.0 Alan Smith SDC 2010 – 16 th March 2010

Services Going 4ward…

• WCF– Clean migration path for projects and developer

skills– Additional features simplifies configuration and

enhances functionality

Page 21: Declarative Services in.NET 4.0 Alan Smith SDC 2010 – 16 th March 2010

Services Going 4ward…

• WCF Workflow Services– New implementation of WF– Will not replace traditional service development

• Evaluate and use where appropriate– Should the service be implemented as a process?

Page 22: Declarative Services in.NET 4.0 Alan Smith SDC 2010 – 16 th March 2010

Services Going 4ward…

• Windows Server AppFabric– Great to have for tracing, monitoring and

management of traditional WCF services– Must-have for WCF Workflow Services– Distributed in-memory cache features are

powerful (formally “Codename Velocity”)

Page 23: Declarative Services in.NET 4.0 Alan Smith SDC 2010 – 16 th March 2010

Further Development• Bits– Visual Studio 2010 RC– Windows Server AppFabric Beta 2

• Webcasts– www.CloudCasts.net

• Questions– [email protected]

• User Groups– SweNug has many events planned for 2010

• Training– WCF, WF and AppFabric courses at Informator

Page 24: Declarative Services in.NET 4.0 Alan Smith SDC 2010 – 16 th March 2010

Tack!