开发者

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

开发者 https://www.devze.com 2023-04-06 11:01 出处:网络
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 E

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开发者_JAVA技巧 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?


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号