Microsoft Sync Framework, el futuro josemiguel.torres Microsoft Sync Framework, el futuro
agenda Entornos de sincronización Que és Microsoft Sync Framework MS Sync Framework 2.0 y v.next SQL Azure DataSync Sync Services for ADO.NET 1.0/2.0 Sumario Recursos
Patrón ocasionalmente conectado
Tecnologías actuales Merge Replication RDA Custom NO Detecta y resuelve conflictos Inicialización automática de esquema de BDD cliente Herramienta RAD Alto coste desarrollo Poco reutilizable Orientado a Servicios Seguimiento incremental de cambios Detección y resolución de conflictos Inicialización automática de esquema de BDD cliente Propagación de modificaciones sobre esquema
Microsoft Sync Framework Interfaz Usuario Respuesta rápida Experiencia usuario rica Servicios Acceso desde cualquier lugar. Alta disponibilidad Sincronización siempre disponible. Optimización comunicaciones Únicamente se propagan las modificaciones. Coste hardware Uso frecuente caché de datos Extensiones para colaboración. Sincronización aún y cuando el servidor no está disponible.
Microsoft Sync Framework? Resolviendo problemas de una sola vez Se ha apostado por la capacidad y la flexibilidad Capacidad: soluciona problemas complejos de sincronización Detección y resolución de conflictos Sincronizaciones atómicas antes problemas externos Fácil de usar y escalable Flexible Independiente de las réplicas Independiente de los protocolos Independiente de los tipos de datos Independiente de las tipologias de red © 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.
Qué aporta Microsoft Sync Framework? Facilita la sincronización entre participantes Facilita la participación de EndPoints propios. Proveedores built-in integrados : V1: Sistema de archivos, RSS, ADO.NET V2: SQL Azure, Live Mesh?, ADO.NET Data Services y más Herramientas integradas y experiencia de usuario Sync Services for ADO.NET SyncToy Project Codename “Anchorage” Sync Live Mesh SmugMug Syncable Store © 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.
Proveedores específicos Sync File System Provider Relational Provider Simple Sharing Extensions (SSE) Provider
Higher-level services Quiero obtener mi servidor offline Higher-level services Quiero sincronizar estos proveedores Quiero crear nuevos proveedores Built-in Endpoints Sync Runtime
En tres pasos… Inicialización y configuración de los proveedores Configurar el agente de sincronización Seguimiento de resultados
Uso de Microsoft Sync Framework Cómo se lleva a cabo la sincronización Sync Application Sync Orchestrator changes changes Sync Provider Sync Provider Data Store Data Store changes changes © 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.
Uso de Microsoft Sync Framework Qué debo desarrollar Aplicaciones Sync para sincronizar orígenes de datos. Utilizar built-in, proveedores de terceros o propios. Desarrollar Providers para tus orígenes y aplicaciones Utilizar Sync Runtime Elige: rendimiento vs complejidad © 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.
Aplicacion Sync Así de fácil! 12/4/2017 9:50 AM Aplicacion Sync SyncOrchestrator orch = new SyncOrchestrator(); orch.LocalProvider = new FileSyncProvider( guid1, “c:\\temp\\myfolder”); orch.RemoteProvider = new LiveMeshProvider( guid2, new NetworkCreditial( username, password), “MyMeshFolder”); orch.Synchronize(); Así de fácil! © 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.
Sync Framework and Live Framework Partnership App Store ? App Cloud LOE Web App Browser Sync Framework Live Framework Provider Client LOE Client LOE Sync Provider Sync Runtime App © 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.
Actores Que hay saber de MSF (Provider dev.) 12/4/2017 9:50 AM Actores Que hay saber de MSF (Provider dev.) ReplicaData ItemData Version Knowledge ... © 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.
MS Sync Framework v2 Mejorado el filtrado Conflictos A nivel de columna “Negociación” de filtros Mejorado rendimiento Conflictos Resolución esp. restricciones Mejorado el logging © 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.
On-Premises Applications Windows Azure Platform 12/4/2017 9:50 AM SQL Azure Data Sync Sync On-Premises Applications Sync Windows Azure Platform © 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.
On-Premises Sync Application Windows Azure Platform 12/4/2017 9:50 AM SQL Azure Data Sync On-Premises Sync Application Windows Azure Platform Sync Application Sync Orchestrator SQL Server SQL Azure SQL Server Sync Provider SQL Azure Sync Provider Sync Runtime © 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.
Clientes Sync Framework Credit Suisse Relational PIM Data SyncToy Files SharePoint 2010 Favorites Relational Lists SharePoint Workspace 2010 (Groove) PricewaterhouseCoopers
DEMO FileSync
Servicios de sincronización para ADO.NET SyncGroup SyncTable SyncTable Sync Agent SyncTable SyncTable SQL Server SQL Server Compact 3.5 Sync Provider DB Sync Provider for SQL Server
Microsoft Sync Framework Tipologías Offline Información en caché Usuarios desconectados Collaboration Contactos, calendario y otros datos en cualquier lugar. Sincronización P2P Colaboración / Offline Microsoft Sync Framework
Offline de 2 capas Client Database SQL Server SyncCommand SyncCommand Sync Agent Local Sync Provider SyncCommand SyncCommand SyncCommand Remote Sync Provider SyncGroup Client Database SyncTable SyncTable SQL Server SyncTable SyncTable
Exponiendo la solucion a N capas SyncCommand SyncCommand Sync Agent SqlCeClient SyncProvider SyncCommand SyncCommand SyncCommand Server Sync Provider Transport SyncGroup SQL Server Compact 3.5 SyncTable SyncTable SQL Server SyncTable SyncTable
DEMO Local DataBase Cache
Situémonos… Envíame los cambios Aplica estos cambios idPieza Descripcion 1 Pieza 1 2 Pieza 2 3 Pieza 3 Modo Sincronización SyncTable’s Proveedor Remoto Sync Agent Envíame los cambios Para aplicar más tarde Aplica estos cambios Que me envió la otra parte idPieza Descripcion 1 Pieza 1 2 Pieza 2 3 Pieza 3 Proveedor Local
Proveedor remoto idPieza Descripcion 1 Pieza 1 2 Pieza 2 3 Pieza 3 1.- Inserta estas filas… 2.- Modifica estas filas… 3.- Elimina estas filas…. idPieza Descripcion 1 Pieza 1 2 Pieza 2 3 Pieza 3 Proveedor Remoto Sync Agent 1.- ¿Qué filas se han añadido? 2.- ¿Qué filas se han modificado? 3.- ¿Qué filas se han eliminado? idPieza Descripcion 1 Pieza 1 2 Pieza 2 3 Pieza 3 Proveedor Local
Seguimiento de cambios Uso de Change Tracking SQL Server 2008 Personalizado Otros… Seguimiento de cambios
Configurando SQL Server 2008 Una característica [nueva] de SQL Server 2008. Almacena y gestiona todas y cada una de la modificaciones acontecidas sobre un cualquier registro. [Metadata] Se habilita a nivel de base de datos, y por cada tabla. Retiene las modificaciones durante un periodo especificado. Permite el seguimiento a nivel de columna. SQL Server provee un conjunto de funciones Si no utilizamos Change Tracking, ¿entonces qué?
Servidores personalizados Si no utilizamos Change Tracking, utilizamos técnicas invasivas contra la base de datos. Se trata de identificar a nivel de fila cuándo [y quién] ha modificado o insertado la fila. Para las eliminaciones se utilizan tablas tombstone, mediante desencadenadores. idPieza Descripcion InsertId InsertTimeStamp UpdateId UpdateTimestamp 1 Pieza 1 A {000-000-A} B {000-000-C} 2 Pieza 2 {000-000-B} Null 3 Pieza 3 {000-000-D} {000-000-E}
DEMO SQL Server
Proveedor remoto SyncAdapter DataAdapter idPieza Descripcion 1 Pieza 1 Select Incremental Inserts Select Incremental Updates Select Incremental Deletes Sync Agent SyncAdapter DataAdapter SelectCommand InsertCommand Connection UpdateCommand Proveedor Remoto DeleteCommand Select Conflict Updated Rows… Podriamos mostrar un clase DbServerSyncProvider Select Conflict Deleted Rows… idPieza Descripcion 1 Pieza 1 2 Pieza 2 3 Pieza 3
Proveedor remoto ¿Cómo identifico las filas insertadas? idPieza SELECT * FROM Pieza WHERE [[han sido insertados desde la última vez] SELECT * FROM Pieza WHERE [han sido modificados desde la ultima vez] Sync Agent SELECT * FROM Pieza WHERE [han sido eliminadosdesde la ultima vez] Proveedor Remoto INSERT INTO Pieza (Descripcion) VALUES (‘xxxxx’) UPDATE Pieza SET Descripcion = ‘xxxx’ WHERE idPieza = ? DELETE Pieza WHERE idPieza = ? ¿Cómo identifico las filas insertadas? idPieza Descripcion 1 Pieza 1 2 Pieza 2 3 Pieza 3 ¿Y las modificadas y eliminadas? ¿Cómo sabremos cuál fue la ultima vez?
Entendiendo las variables de sesión ¿Cuál es la versión actual? Variables del contexto de la sincronización que denotan la versión actual. ¿Cuál es la versión de la última sincronización? Variables del contexto de la sincronización que denotan la versión de la última sincronización. ¿Quién ha modificado? Variables que identifican quién o qué cliente (consumidor) ha modificado. ¿Es la primera inicialización? …
DEMO Proveedor Remoto
Proveedor de sincronización local Almacena la información de estado de las tablas locales que van a intervenir en la sincronización. Propaga las modificaciones acontecidas en las tablas hacía el proveedor remoto, desde la última sincronización. Aplica las modificaciones incrementales acontecidas en el proveedor remoto a la base de datos local. Detección de conflictos. Existe un proveedor específico para SQL Server Compact 3.5. Establece toda la complejidad y comportamiento de forma transparente para el desarrollador.
Inicializar la base de datos local Únicamente se requiere de la existencia del archivo de base de datos. Se propaga TODA la definición de la tabla que interviene en la sincronización, excepto: La restricciones FOREIGN KEY, UNIQUE y DEFAULT. Podemos intervenir en la creación del esquema en tiempo de ejecución. Foreign key, unique y default
DEMO Proveedor Local
Manejo de conflictos Conflictos se detectan a nivel de fila. Los errores durante la sincronización son un tipo de conflicto. Importante evitar conjunto de datos susceptibles de conflicto innecesariamente. Uso recomendado de Filtros. Pueden tener lugar tanto en el Servidor como en el Cliente. Tipos: Cliente elimina y servidor actualiza (un mismo registro) Cliente inserta y servidor inserta (un mismo registro) Cliente actualiza y servidor elimina (un mismo registro) Cliente actualiza y servidor actualiza (un mismo registro)
Mostrar ejemplo de base de datos cache… DEMO Control de conflictos
Resources Sync Developer Center http://msdn.microsoft.com/sync SDK (including documentation) Whitepapers Samples (including several end-to-end) Sync Blog http://blogs.msdn.com/sync Announcements Tips and Tricks SQL Labs www.sqlserviceslabs.com Cutting edge prototypes and pre-release functionality
¡¡¡Muchas gracias!!!! josemiguel@desarrollomobile.net Blog: http://josemigueltorres.net Twitter: http://twitter.com/alegrebandolero ¡¡¡Muchas gracias!!!! josemiguel@desarrollomobile.net