accounting fulfillment service proxies models

37

Upload: barrie-mclaughlin

Post on 12-Jan-2016

216 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Accounting Fulfillment Service Proxies Models
Page 2: Accounting Fulfillment Service Proxies Models

Offline Microsoft Silverlight ApplicationsDEV339

Steve LaskerLead Program ManagerMicrosoft Silverlight

Page 3: Accounting Fulfillment Service Proxies Models

Offline & Silverlight

Basics of enabling your app for offline scenariosSilverlight Implementation

Page 4: Accounting Fulfillment Service Proxies Models

Recipe

Determining Online/Offline State Local Storage Defined Offline Operations Categorized Data How To Retrieve Data

Not just about services

Data via MessagingHow to Sync ChangesSaving

Page 5: Accounting Fulfillment Service Proxies Models

Silverlight Application - MVVM

Accounting

Fulfillment

Views

View Models

ServiceProxies

Models

Page 6: Accounting Fulfillment Service Proxies Models

Silverlight Offline Application

Local Storage

Accounting

Fulfillment

ServiceProxies

Views

View Models

Models

Page 7: Accounting Fulfillment Service Proxies Models

demo

Determining Offline State

Page 8: Accounting Fulfillment Service Proxies Models

return NetworkInterface.GetIsNetworkAvailable();

Determining Online/Offline State

Use: NetworkInterfaceWrap w/WorkOffline

Monitor NetworkAddressChanged Event

// Monitor Network Changes (Online/Offline)NetworkChange.NetworkAddressChanged += NetworkAddressChanged;…void NetworkAddressChanged(object sender, EventArgs e) { CheckOnlineState();}

private bool _isOnline;

public bool IsOnline { get { if (WorkOffline) return false; return NetworkInterface.GetIsNetworkAvailable(); }}private void CheckOnlineState() { if (IsOnline != _isOnline) { _isOnline = this.IsOnline; NotifyPropertyChanged("IsOnline"); }}

Page 9: Accounting Fulfillment Service Proxies Models

Recipe

Determining Online/Offline State √Local Storage Defined Offline Operations Categorized Data How To Retrieve Data

Not just about services

Data via MessagingHow to Sync ChangesSaving

Page 10: Accounting Fulfillment Service Proxies Models

Canonical RequirementsPersistence – survive app restartsIndexed – data grows quickly, need quick accessDisk Paging – Only pull what you need from diskRelationships & GraphsLocking – multi threaded/app accessTransactionsProgramming Model (T-SQL, LINQ, …)

Local Storage

Customer_IdNameAddress

CustomerVehicle_IdYearMakeModel

Vehicle

Claim_IdCustomer_IdVehicle_Id

Claim

HTML5

IndexDBWEB SQL Database

Too much to cover in this session

Page 11: Accounting Fulfillment Service Proxies Models

Application Overview

demo

Page 12: Accounting Fulfillment Service Proxies Models

Calendar of AppointmentsClaimsDamages

Upload Images, w/descriptions & vehicle location

ReportsVehiclesNewsBranch StylesHelp

Operations – What Should Work Offline?

Page 13: Accounting Fulfillment Service Proxies Models

Offline Operations

Calendar of AppointmentsClaimsDamages

Upload Images, w/descriptions & vehicle location

ReportsVehiclesNewsBranch StylesHelp

Page 14: Accounting Fulfillment Service Proxies Models

demo

Disabling Online Operations

Page 15: Accounting Fulfillment Service Proxies Models

Check Point

Determining Online/Offline State √Local Storage √Defined Offline Operations √Categorized Data How To Retrieve Data

Not just about services

Data via MessagingHow to Sync ChangesSaving

Page 16: Accounting Fulfillment Service Proxies Models

User/Branch Info

Branch_Id

Appointments & Claims

LookupsVehicle Info

StandardVehicleInfo

State*

BranchOffice

BranchStyles

Claim

ClaimStatus

Appointment

ClaimDamage

VehicleBodyType

StandardVehicleInfo

State*

BranchOffice

BranchStyles

Claim

ClaimStatus

Appointment

ClaimDamage

VehicleBodyType

Reference Data Typically cached in completeness

Activity Data Typically partitioned per user

Appraiser_Id

Categorize Your Data

UserInfoUserInfo

Partitioned Reference Data Cached for offlinePartitioned, per user

VehicleReferencePhoto

VehicleReferencePhoto

Page 17: Accounting Fulfillment Service Proxies Models

How’d My Data Get Local

Passive CachingCache results as requested

Active CachingAlways work locallySync all changes

HybridActively cache Reference & Activity dataWhen online, request from remote

Passively cache results

Page 18: Accounting Fulfillment Service Proxies Models

Entity Managerentity Manager

Silverlight Offline Application w/Messaging

Local Storage

Accounting

Fulfillment

ServiceProxies

Message

Views

View Models

Models

Page 19: Accounting Fulfillment Service Proxies Models

entity Manager

public class GetAppointmentsMessage : Message {

Message Pipeline

ProcessMessage(Message message)

OnlineOperation(){ … }

ProcessMessageResults(List<MessageResult> messageResults) {MessageCompleted.Invoke(message);

}

OfflineOperation() { … }

Views

View Models OnEntityChanged(…)

Page 20: Accounting Fulfillment Service Proxies Models

demo

Messaging Operations

Page 21: Accounting Fulfillment Service Proxies Models

entity Manager

Sync Groups

Synching Local Data

Local Storage

Accounting

Fulfillment

ServiceProxies

Message

Views

View Models

Models

Reference Data

Activity Data

Page 22: Accounting Fulfillment Service Proxies Models

Getting Deltas

ChallengeHow to manage changes for N users

SolutionsServer Side Tracking

Client asks for “my” changes?Simple for the client, hard for the server – scalability limits

Client Side TrackingClient asks give me changes since XA little more work for the client, but endless scale

Page 23: Accounting Fulfillment Service Proxies Models

Anchor Based Changes

Client stores “Last Sync Time” for each collectionCreate “Sync Groups”

Group Collections / Sync Group

SyncGroup Frequency (TimeSpan)

Reference 24 hours

Activity 5 minutes

Entity SyncGroup Anchor

States Reference 5/1/11 7:00:00 AM UTC

ClaimStatus Reference 5/1/11 7:00:00 AM UTC

StandardVehicleInfo Reference 5/1/11 7:00:00 AM UTC

VehicleReferencePhoto Reference 5/1/11 7:32:05 AM UTC

Appointments Activity 5/16/11 8:08:15 AM UTC

Claims Activity 5/16/11 8:08:15 AM UTC

ClaimDamage Activity 5/16/11 8:08:15 AM UTC

Page 24: Accounting Fulfillment Service Proxies Models

Deltas Include…

InsertsUpdatesDeletes

But, how do I get a delete, if it’s deleted?

Tombstones

Page 25: Accounting Fulfillment Service Proxies Models

Tombstones???

Maintained by Database Triggers

Appointment Appointment_Tombstone

Appointment_IdAppraiser_IdDeletedDate

Appointment_IdAppraiser_IdCustomer_IdVehicle_Id…CreatedLastEdit

Claim

ClaimDamage

Claim_Tombstone

ClaimDamage_Tombstone

CREATE TRIGGER AdjusterAppointment_Delete_UpdateTombstone ON AdjusterAppointment AFTER DELETEAS INSERT INTO AdjusterAppointment_Tombstone ( AdjusterAppointmentGuid, Adjuster_Id ) SELECT AppointmentGuid, Adjuster_Id FROM deleted

Page 26: Accounting Fulfillment Service Proxies Models

demo

Getting Deltas

Page 27: Accounting Fulfillment Service Proxies Models

Check Point

Determining Online/Offline State √Defined Offline Operations √Categorized Data Local Storage √How To Retrieve Data √

Not just about services

Data via Messaging √How to Sync Changes √Saving

Page 28: Accounting Fulfillment Service Proxies Models

Saving

Save LocallySync w/Server

Just another message

Page 29: Accounting Fulfillment Service Proxies Models

demo

Saving

Page 30: Accounting Fulfillment Service Proxies Models

entity Manager

Sync Groups

Offline Silverlight Application w/Messaging

Local Storage

Accounting

Fulfillment

ServiceProxies

Message

Views

View Models

Models

Reference Data

Activity Data

Page 31: Accounting Fulfillment Service Proxies Models

Check Point

Determining Online/Offline State √Defined Offline Operations √Categorized Data √Local Storage √How To Retrieve Data √

Not just about services

Data via Messaging √How to Sync Changes √Saving √

Page 32: Accounting Fulfillment Service Proxies Models

Summary

Network resiliency doesn’t happen as an afterthoughtBuilding resilient applications is the future, not a stop gap

It’s how all important resources are managed

Design your apps to work offline from the beginningWhen things are connected, they work greatWhen “stuff” happens, your business continues to function

Contribute to usability & business stability

Page 33: Accounting Fulfillment Service Proxies Models

Hands On Labs

DEV386HOL: Microsoft Silverlight Data BindingDEV388HOL: Web Services and Microsoft SilverlightDEV389HOL: Using WCF RIA ServicesDEV390HOL: Using the MVVM Pattern in Microsoft Silverlight Applications

Find Me Later At the Silverlight Boothhttp://Blogs.MSDN.com/SteveLasker

Page 34: Accounting Fulfillment Service Proxies Models

Related Sessions

DEV330: Delivering End-End Video Workflow Using Microsoft SharePoint, IIS Media Services,Microsoft Expression Encoder and Microsoft Silverlight

DEV340: Tackle the Complexity of Async Calls in Microsoft Silverlight and WPF ClientsDEV209: From Zero to Silverlight in 75 MinutesDEV331: A Lap around Microsoft Silverlight 5DEV210: Microsoft Silverlight, WCF RIA Services and Your Business ObjectsDEV339: Offline Microsoft Silverlight ApplicationsDEV337: Moving Your App and Skills from Windows Forms to Microsoft Silverlight (and WPF)DEV356: Integrating Security Roles into Microsoft Silverlight Applications

http://Silverlight.net Find Me Later At the Silverlight Boothhttp://Blogs.MSDN.com/SteveLasker http://SLOfflineDemo.codeplex.com/

Page 35: Accounting Fulfillment Service Proxies Models

Complete an evaluation on CommNet and enter to win!

Page 36: Accounting Fulfillment Service Proxies Models

Related Sessions

DEV330: Delivering End-End Video Workflow Using Microsoft SharePoint, IIS Media Services,Microsoft Expression Encoder and Microsoft Silverlight

DEV340: Tackle the Complexity of Async Calls in Microsoft Silverlight and WPF ClientsDEV209: From Zero to Silverlight in 75 MinutesDEV331: A Lap around Microsoft Silverlight 5DEV210: Microsoft Silverlight, WCF RIA Services and Your Business ObjectsDEV339: Offline Microsoft Silverlight ApplicationsDEV337: Moving Your App and Skills from Windows Forms to Microsoft Silverlight (and WPF)DEV356: Integrating Security Roles into Microsoft Silverlight Applications

http://Silverlight.net Find Me Later At the Silverlight Boothhttp://Blogs.MSDN.com/SteveLasker http://SLOfflineDemo.codeplex.com/

Page 37: Accounting Fulfillment Service Proxies Models

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