Nuno Godinho

49
Developing Line-of-Business Applications with Microsoft Silverlight Nuno Godinho [email protected]

description

apresentação do Nuno Godinho no evento RIAPT de dia 16 de Janeiro.

Transcript of Nuno Godinho

Page 1: Nuno Godinho

Developing Line-of-Business Applications with Microsoft Silverlight

Nuno [email protected]

Page 2: Nuno Godinho

Agenda

Introduction

Recommended Pattern

Communications

Beyond the Browser

Extensibility

Q&A

Page 3: Nuno Godinho

About Me

Nuno Filipe Godinho

Independent Consultant

Mail: [email protected]

[email protected]

Blogs: http://pontonetpt.com/blogs/nunogodinho

http://xamlpt.com/blogs/nunogodinho

http://weblogs.asp.net/nunogodinho

http://msmvps.org/blogs/nunogodinho

Twitter: @NunoGodinho

Page 4: Nuno Godinho

Agenda

Introduction

Recommended Pattern

Communications

Beyond the Browser

Extensibility

Q&A

Page 5: Nuno Godinho

IntroductionProblem Statement

Problems◦ N-Tier

◦ Controls

◦ Rich Text Support

◦ Multi-language Support

◦ Customer Devices Interaction

◦ Communications

◦ Extensibility

◦ Offline Support

◦ Interoperability

Page 6: Nuno Godinho

IntroductionChallenges using N-Tier applications

LoB applications use data that needs to flow across tiers

Created and used through basic CRUD operations

In an internet application, there is a trust boundary between the client and the mid-tier server

Important to have a well defined and secured resources that are available to the client tier and also what operations are permitted

Page 7: Nuno Godinho

IntroductionChallenges using N-Tier applications

The validation needs to run on Client and On Server as well as on Mid-Tiers

Common validation across the tiers

Services that may be shared with other applications

Page 8: Nuno Godinho
Page 9: Nuno Godinho

IntroductionVision and Goals

Simplify RIA-style application development◦ n-tier is hard, and un-natural

◦ Focus on data-driven apps

Bring ASP.NET-style productivity to RIA development◦ Building blocks for data, security, etc.

◦ Focus on scenarios

Page 10: Nuno Godinho

IntroductionValue Propositions

Focus on data in an end-to-end manner

A unified story for client and server development

A prescriptive framework that targets key scenarios, and leads the common developer to a pit of success

Page 11: Nuno Godinho

IntroductionValue Propositions

Simplify application development across tiers and trust boundary ◦ Provides a set of tools to build the multiple tiers of an application

together

◦ Application logic remains aware of tier and trust boundaries

◦ Uses the end-to-end flow of data and metadata described earlier

◦ Code generation and shared code

Enhance the experience by providing multiple choices for sharing logic while respecting tier and trust boundaries

Page 12: Nuno Godinho

ApplicationBrowserRich Internet Application

DB

Service

Other Applications

IntroductionA Unified Story for Client and Server

Client is an extension of the server

A single logical application

Data Access

Layer

App

Logic

Services

HTMLPresentation

LogicNetwork

Page 13: Nuno Godinho

IntrodutionValue Propositions

Define and support a pattern for exposing a set of operations on resources

DomainService◦ Define a set of operations on resources

Framework and Tools◦ Collaborate to generate code for a corresponding client-tier

◦ Services for authentication and user settings can be used out-of-the box

Page 14: Nuno Godinho

IntroductionA Prescriptive Pattern

Rich Internet Application

DB

Services

Data Access

Layer

App

Logic

Presentation

LogicNetwork

Domain

Context

Domain

Service

Under the covers infrastructure

Page 15: Nuno Godinho

IntroductionA Single Pattern that Scales and Grows

Support for multiple presentation tiers and data access technologies

App

Logic

Databases

ADO.NET,

ORMs (LTS, EF, …)

CLR

Lists/Objects

Repository

(nHibernate, …)

Services

REST/SOAP

(Azure, …)SOAP,

XML,

JSON,

Binary

.NET Clients

Silverlight, WPF

Standards

Clients

JavaScript

Server

Rendering

HTML, SEO,

Printing, …

Services

WCF

Unit Test

Code

Page 16: Nuno Godinho

Line-of-Business Application

Page 17: Nuno Godinho

Agenda

Introduction

Recommended Pattern

Communications

Beyond the Browser

Extensibility

Q&A

Page 18: Nuno Godinho

Recommended Pattern

Page 19: Nuno Godinho

Recommended PatternMVVM

Why?◦ Separation of concerns

◦ Better Workflow between Developer and Designer

◦ Easier Testability

Why not MVC?◦ We need to have access to the Code-Behind and MVC doesn’t support

that, only Code-Behind Pattern does, but doesn’t delivers easy separation of concerns

Page 20: Nuno Godinho

Recommended PatternMVVM

Display data in Controls

UI Friendly Entities, UI State, Actions

Entities representing data

Page 21: Nuno Godinho

MVVM Implementation in Silverlight

Page 22: Nuno Godinho

Agenda

Introduction

Recommended Pattern

Communications

Beyond the Browser

Extensibility

Q&A

Page 23: Nuno Godinho

Interopwith other

Platforms & WS-*

ASMX & WSE

Attribute-Based

Programming

Enterprise Services

REST / HTTP Programming

HTTP Services

Message-Oriented

Programming

System.Messaging

ExtensibilityLocation

transparency

.NET Remoting

CommunicationUnified Programming Model

Page 24: Nuno Godinho

CommunicationsWindows Communication Foundation (WCF)

Page 25: Nuno Godinho

CommunicationsWCF RIA Services

Framework, tools and services with prescriptive pattern for n-tier applications

Data

Access

Layer

(DAL)

App

Logic

Database

View

Web

Service

App

Logic

Trust

Boundary

Page 26: Nuno Godinho

Client project

CommunicationsWCF RIA Services

Design-time view

Server project

Domain

Service

Data

Access

Layer

(DAL)

Entities

Solution (Application)

Views

Domain

Context

EntitiesBuild, reflect

& code-gen

Page 27: Nuno Godinho

Silverlight

CommunicationsRun-time view (entity lifecycle)

Web server

Domain

Service

Data

Access

Layer

(DAL)

Application

ViewsDomain

Context

LoadQuery

Entities

Results

Submit

Entities

Submit

Results

Page 28: Nuno Godinho

CommunicationsServices

Authentication

Roles

User profile

All integrate w/ ASP.NET infrastructure

Page 29: Nuno Godinho

WCF RIA Services

Page 30: Nuno Godinho

Agenda

Introduction

Recommended Pattern

Communications

Beyond the Browser

Extensibility

Q&A

Page 31: Nuno Godinho

Beyond the Browser

Out-of-Browser Applications

Trusted Applications

Page 32: Nuno Godinho

Beyond the BrowserOut-of-Browser – Already on Silverlight 3

Configuration Based

AppManifest.xml

Can be enabled in an existing application without rebuilding

Install option on its right-click menu

Can run without a network connection

You can implement network detection and provide offline

support when a connection is unavailable

Page 33: Nuno Godinho

Beyond the BrowserOut-of-Browser

Windowing API

WebBrowser control

HtmlBrush

Notification (aka. Toast)

Page 34: Nuno Godinho

Beyond the BrowserTrusted Applications

OOB with elevated privileges

COM Interop in Windows

File system access

Cross-domain networking access

Full keyboard support in Full-Screen Mode

Page 35: Nuno Godinho

Beyond the Browser

Page 36: Nuno Godinho

Agenda

Introduction

Recommended Pattern

Communications

Beyond the Browser

Extensibility

Q&A

Page 37: Nuno Godinho

Extensibility

Prism v2

MEF – Managed Extensibility Framework

Page 38: Nuno Godinho

ExtensibilityPrism v2

Prism is a set of options

Use what you want and ignore the rest◦ Example:

Choose Modules and Commanding, but ignore Event Aggregation and Regions

Page 39: Nuno Godinho

ExtensibilityPrism v2

Prism Technical Concepts

Page 40: Nuno Godinho

ExtensibilityMEF – Managed Extensibility Framework

A new library in Silverlight 4 for building applications that can be incrementally

extended.

Page 41: Nuno Godinho

ExtensibilityMEF – Managed Extensibility Framework

An Application is built of parts.

Page 42: Nuno Godinho

ExtensibilityMEF – Managed Extensibility Framework

Export it.

Import it.

Compose it.

Page 43: Nuno Godinho
Page 44: Nuno Godinho

ExtensibilityMEF – Managed Extensibility Framework

Export it - Metadata

Widget1

[ExportMetadata(“Location”,Location.Top)][Export(typeof(UserControl))]public class Widget1 : UserControl{

public string Message {get{return(string) Button.Content;}

set{Button.Content=value;}}

}

Export

Page 45: Nuno Godinho

ExtensibilityMEF – Managed Extensibility Framework

Import it - Metadata

MainPage

[Export(typeof(UserControl))]public class MainPage: UserControl{

[ImportMany(typeof(UserControl))]public IEnumerable<Lazy<UserControl, IWidgetMetadata> {

get;set;}

}

ImportMany

Page 46: Nuno Godinho

MEF – Managed Extensibility Framework

Page 47: Nuno Godinho

Agenda

Introduction

Recommended Pattern

Communications

Beyond the Browser

Extensibility

Q&A

Page 48: Nuno Godinho
Page 49: Nuno Godinho

Nuno Filipe GodinhoIndependent Consultant

Mail: [email protected]@itech4all.com