Silverlight 4 Reference Architecture for LOB apps

17
© 2010 Aviva Solutions 16-05-22 A Silverlight 4 Reference Architecture for Line-of-Business Applications Dennis Doomen dennis.doomen@avivasoluti ons.nl

description

A short introduction to my current Silverlight 4 reference architectuer with elements of CQRS.

Transcript of Silverlight 4 Reference Architecture for LOB apps

Page 1: Silverlight 4 Reference Architecture for LOB apps

© 2010 Aviva Solutions 8 april 2023

A Silverlight 4 Reference Architecturefor Line-of-Business Applications

Dennis Doomen

[email protected]

Page 2: Silverlight 4 Reference Architecture for LOB apps

© 2010 Aviva Solutions 8 april 2023Dennis Doomen

Requirements• Testable• Pragmatic• Single Responsibility Principle• Dependency Injection• Don’t DIY• …whatever your project requires

Page 3: Silverlight 4 Reference Architecture for LOB apps

© 2010 Aviva Solutions 8 april 2023

The traditional architecture…

Page 4: Silverlight 4 Reference Architecture for LOB apps

© 2010 Aviva Solutions 8 april 2023

Service Agent

DTOs

View Models

Views (XAML + C#)

Domain Model

Repositories

Database

NHibernate

(+ Fluen

t & LINQ)

WCF

Silverlight 4

Unit-of-Work Service Agents

Shell

Backoffice System

Application Controller

Service Interface

Workflows

External Service

Service Actions

Well-known Rich domain models Many frameworks Very flexibele× Lots of work× Lots of plumbing needed× Not using RIA frameworks× DTO conversion troubles× No eager loading

Page 5: Silverlight 4 Reference Architecture for LOB apps

© 2010 Aviva Solutions 8 april 2023Dennis Doomen

Model View-ViewModel

XAML (+C#) ViewModel

Model

ServiceAgent

    INotifyPropertyChanged

Loads

Events

{Binding}

CommandCall

Page 6: Silverlight 4 Reference Architecture for LOB apps

© 2010 Aviva Solutions 8 april 2023

As Microsoft wants it…

Page 7: Silverlight 4 Reference Architecture for LOB apps

© 2010 Aviva Solutions 8 april 2023

Domain Context

Changesets

View Models

Views (XAML + C#)

Entities

Database

WCF RIA Services

Silverlight 4

Entity Framework Service Agents

Shell

Backoffice System

Application Controller

Domain Service

External Service

Easy to build Simple domain models Less plumbing needed No DTO conversions needed Maximizes RIA frameworks Great for CRUD Batching× CRUD-based× Domain model not possible× No dynamic relationship

loading× No enum support

Business Actions

Page 8: Silverlight 4 Reference Architecture for LOB apps

© 2010 Aviva Solutions 8 april 2023

Entity Framework and WCF RIA Services?

Page 9: Silverlight 4 Reference Architecture for LOB apps

© 2010 Aviva Solutions 8 april 2023Dennis Doomen

WCF RIA Services Client-side Validation Automatic change-tracking Client-side LINQ Code Sharing Great for CRUD i.c.m. Entity Framework Built-in authorization OData support WCF based× No rich domain models× No eager loading× No enum support× Not persistency ignorant

Page 10: Silverlight 4 Reference Architecture for LOB apps

© 2010 Aviva Solutions 8 april 2023Dennis Doomen

Entity Framework Great designer environment Code Sharing Fluent interface POCO support Great integration with WCF RIA/Data Mapping attributes× Mapping attributes× No free support for other vendors× No enum support× No 2nd level caching

Page 11: Silverlight 4 Reference Architecture for LOB apps

© 2010 Aviva Solutions 8 april 2023

Then what?

Page 12: Silverlight 4 Reference Architecture for LOB apps

© 2010 Aviva Solutions 8 april 2023

Service Agent

DTOs

View Models

Views (XAML + C#)

Domain Model

Repositories

Command Handlers

Database

NHibernate

(+ Fluen

t & LINQ)

WCF Data Services

Silverlight 4

Unit of Work Service Agents

Domain Events

Policy Injection

Logging

Shell

Bootstrapper

Caliburn Micro

Unity 2 of M

EF

Unity 2 or M

EF

Coroutines

Enterprise Library 5

Backoffice System

Application Controller

Command Service

Commands

Event Handlers

Rest Service

Workflows

External Service

Service Actions

Page 13: Silverlight 4 Reference Architecture for LOB apps

© 2010 Aviva Solutions 8 april 2023Dennis Doomen

WCF Data Services Client-side LINQ Automatic change-tracking Great for querying OData support Eager loading Projections WCF based× Built-in authorization× Code Sharing× Client-side Validation× Rich domain models

Page 14: Silverlight 4 Reference Architecture for LOB apps

© 2010 Aviva Solutions 8 april 2023

Commanding

Page 15: Silverlight 4 Reference Architecture for LOB apps

© 2010 Aviva Solutions 8 april 2023

Domain Events

Page 17: Silverlight 4 Reference Architecture for LOB apps

© 2010 Aviva Solutions 8 april 2023

[email protected]

Twitter@ddoomen

Blogwww.dennisdoomen.net