Pablo Castro Software Architect Microsoft Corporation TL08.

25
Offline-Enabled Data Services And Desktop Applications Pablo Castro Software Architect Microsoft Corporation TL08

Transcript of Pablo Castro Software Architect Microsoft Corporation TL08.

Page 1: Pablo Castro Software Architect Microsoft Corporation TL08.

Offline-Enabled Data Services And Desktop Applications

Pablo CastroSoftware ArchitectMicrosoft Corporation

TL08

Page 2: Pablo Castro Software Architect Microsoft Corporation TL08.

Why The problem space

What The developer experience

How A look at the details

When Standard roadmap drill

Agenda

Page 3: Pablo Castro Software Architect Microsoft Corporation TL08.

Why: Motivation

Why “offline” Access to a service may not be always available Bandwidth may not be enough/too expensive etc.

Why “data services” We have sync technology for databases, but… Lots of data now sits behind a service boundary We can layer more data capabilities on

services with a uniform interface

Page 4: Pablo Castro Software Architect Microsoft Corporation TL08.

Application Scenarios

Offline-capable applications Microsoft Outlook-style applications Service is typically domain specific, includes

business logic

Application speed-up/bandwidth usage Cache service data locally for fast processing Could be a general purpose data service

Closed-system versus external services Service side may be a 3rd party service

Page 5: Pablo Castro Software Architect Microsoft Corporation TL08.

What: Taking Services Offline

Project Codename “Astoria Offline”

End-to-end solution Visual Studio integrated experience Sync APIs, algorithms, formats, protocols Modeled at the level of conceptual “entities” Client and service environment setup

Sync-enable database schemas Generate sync-enabled clients

Maintains an open interface

Page 6: Pablo Castro Software Architect Microsoft Corporation TL08.

Application ModelSync-enabled

service

1-tier client application

Sync in the background

Local schema follows service

Online clients can consume

service

Page 7: Pablo Castro Software Architect Microsoft Corporation TL08.

Sync-Enabling a Service

“Piece of cake” scenario Relational database through Entity Framework

1. Augment the database with sync information2. Add sync-related elements to metadata files3. Enable synchronization in the service itself

You can also do everything manually

Page 8: Pablo Castro Software Architect Microsoft Corporation TL08.

Creating Sync-Enabled Clients

Client-side “piece of cake” flow “Add service reference” will prompt

if the server is sync-enabled1. Download service metadata2. Create local Compact database3. Setup Entity Framework data-access layer4. Add sync support to both database and

Entity Framework

Can also use the building blocks independently

Page 9: Pablo Castro Software Architect Microsoft Corporation TL08.

Building On Existing Technology

Data Services Framework: RESTful data services

Sync Framework

Entity Framework:Model & Data Access

Data source extensibility

Local store: SQL Server Compact

Entity Framework: local data access

Database:SQL Server

Sync Framework

Regular Desktop/Server

application

Page 10: Pablo Castro Software Architect Microsoft Corporation TL08.

Typical Requirements

Business logic Server: Query and change interceptors Client: Usual UI interaction, plus sync events

Conflict detection and resolution We’ll precisely detect conflicts You provide resolution handlers

Incremental synchronization Batching & dependency management

Choosing which data to sync Scopes

Page 11: Pablo Castro Software Architect Microsoft Corporation TL08.

Security Aspects

Authentication ASP.NET authentication model applies Built-in Windows, Forms auth Modules for Basic and custom schemes

Authorization Query/change interceptors on the server Use ASP.NET roles or custom code

Page 12: Pablo Castro Software Architect Microsoft Corporation TL08.

How: The Details

Synchronization Strategy Interaction model Database schema requirements

Page 13: Pablo Castro Software Architect Microsoft Corporation TL08.

Synchronization Strategy

Follow the Microsoft Sync Framework way Multi-master replication

Peers make changes independently Sync makes peers aware of all changes

Reliable, precise conflict detection Minimize over-enumeration

Page 14: Pablo Castro Software Architect Microsoft Corporation TL08.

Basic Concepts

“Scope” All things you want to synchronize

“Version” A change is tagged with “who” and “when”

“Knowledge” Concise description of the set of

changes that a peer is aware of Can be understood by any peer Main operations on knowledge

Test if a given knowledge covers a given change Add one piece of knowledge to another to produce

combined knowledge

Page 15: Pablo Castro Software Architect Microsoft Corporation TL08.

Interaction Model

Request changes based on A’s knowledge Enumerate changes in B: Is B’s version covered by

A’s knowledge? If not, send Send changes: Version of change, B’s knowledge Apply Changes: Is A’s version covered by

B’s knowledge? If not, there is a conflict

A B1. Request changes

3. Send changes

4. Apply Changes 2. Enumerate Changes

Page 16: Pablo Castro Software Architect Microsoft Corporation TL08.

Data Store Requirements

Per-scope A place to put knowledge in (1 row)

Per-entity Creation version (node, tick count) Modification version (node, tick count) Globally unique Sync ID Deletion markers

Page 17: Pablo Castro Software Architect Microsoft Corporation TL08.

Default strategy used by Visual Studio Side tables for sync version information Columns in user tables (timestamp x 2, syncid) Delete trigger for deletion markers Gets better with Compact and SQL Server 2008

Can be completely replaced We define an “API” in terms of entry points Encapsulated in Entity Framework

metadata files

Sync Metadata In Entity Framework

Page 18: Pablo Castro Software Architect Microsoft Corporation TL08.

When: Roadmap To "Astoria Offline"

Alpha preview release before end of year We’ll ship CTPs as we make progress What we want to take on

v1: core protocol/service support in place, great tooling

Later: first-class devices support, more application services, scenarios for synchronization other than offline

Page 19: Pablo Castro Software Architect Microsoft Corporation TL08.

We'd Love To Hear From You

We are following our “transparent design” process Design notes posted in the Astoria Team blog

http://blogs.msdn.com/astoriateam Feedback is welcome, the earlier the

more likely we can incorporate it You get to see team members in an awkward

setting trying to explain features in videos

Page 20: Pablo Castro Software Architect Microsoft Corporation TL08.

Summary

“Astoria Offline” enables applications to take data from services offline Work while disconnected Speed and bandwidth optimizations

End-to-end solution Tools, runtime, database support Starts easy, incrementally customizable

Builds on existing technology for data, services and synchronization

Page 21: Pablo Castro Software Architect Microsoft Corporation TL08.

Resources

Blogs Astoria team

http://blogs.msdn.com/astoriateam Mine

http://blogs.msdn.com/pablo @ MSDN

Data: http://msdn.microsoft.com/data Sync:

http://msdn.microsoft.com/en-us/sync/default.aspx @ PDC

TL30 Microsoft Sync Framework Advances TL07 Developing Applications Using Data Services TL20 Entity Framework Futures

Page 22: Pablo Castro Software Architect Microsoft Corporation TL08.

Please use the microphones provided

Q&A

Page 23: Pablo Castro Software Architect Microsoft Corporation TL08.

Evals & Recordings

Please fill

out your

evaluation for

this session at:

This session will be available as a recording at:

www.microsoftpdc.com

Page 24: Pablo Castro Software Architect Microsoft Corporation TL08.

© 2008 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.

Page 25: Pablo Castro Software Architect Microsoft Corporation TL08.