Microsoft Sync Framework, Microsoft Entity Framework 4.1 & SQL CE 4.0

青春壹個敷衍的年華 提交于 2019-12-11 10:29:09

问题


We are developing an occasionally connected application that uses SQL Compact on the client machines and SQL Server 2008 (with change tracking) on the server. The application is being developed using Entity Framework’s code first model, which requires that the local SQL Compact database be 4.0. We would like to use Microsoft Sync Framework to handle synchronizing data from the central server to the occasionally connected clients but recently discovered that while SQL Compact 3.5 SP2 is compatible with Sync Framework, 4.0 is not (http://blogs.msdn.com/b/sqlservercompact/archive/2011/01/12/microsoft-sql-server-compact-4-0-is-available-for-download.aspx). We wanted to use SQL Compact for this application to leverage the SQLCEClientSyncProvider provided by Microsoft and were unable to find a SQL Express equivalent. It seems we are left with a couple options:

1) Write a custom sync provider to leverage SQL Express on the client end. From what I have seen, this is not a trivial task and a tight deadline makes this quite risky. 2) Use SQL Compact 3.5 SP2 and convert the Entity Framework code from a “code first” model to a “model first” one. I am not sure what all would be involved in this approach or how much rework would be required.

And my question:

Is there a better solution for using all of these technologies together that we are not considering? Which method would be the path of least resistance? I was surprised to find in my research that using Sync Framework with SQL Express on the client side is not more fully supported. Is Sync Framework compatibility something on the horizon for SQL CE 4.0?


回答1:


there are two types of database providers for Sync Framework: the offline provider and the collaboration/peer-to-peer provider.

the offline providers are the SqlCeClientSyncProvider/DbServerSyncProvider which is used by the Local Database Cache project item in Visual Studio which only supports SqlCe on the client.

the collaboration providers SqlCeSyncProvider/SqlSyncProvider supports SqlCe, Sql Express, Sql Server and Sql Azure on both client and server.

afaik, there is no Sql Ce 4.0 support in the near future and there is no Sync Framework 4.0, just 2.1. MS has recently released a Sync Framework Toolkit based on the V4 CTP but its more to expand the client support to non-MS platform.

having said that, i suggest you go with the SqlCeSyncProvider/SqlSyncProvider combo as they probably require the least amount of customization.

see: Tutorial: Synchronizing SQL Server and SQL Server Compact



来源:https://stackoverflow.com/questions/7474776/microsoft-sync-framework-microsoft-entity-framework-4-1-sql-ce-4-0

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!