1

I'm currently exploring different avenues for a new application that falls in the "occasionally connected" category. After some research I "decided" to go for a central SQLServer and clients with SqlCompact database that would sync when required/possible.

When "connecting" everything together I ended up with the following exception.

[A]System.Data.SqlServerCe.SqlCeConnection cannot be cast to 
[B]System.Data.SqlServerCe.SqlCeConnection. 
Type A originates from 'System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' in the context 'Default' 
at location 'C:\Windows\assembly\GAC_MSIL\System.Data.SqlServerCe\4.0.0.0__89845dcd8080cc91\System.Data.SqlServerCe.dll'. 
Type B originates from 'System.Data.SqlServerCe, Version=3.5.1.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' in the context 'Default' 
at location 'C:\Windows\assembly\GAC_MSIL\System.Data.SqlServerCe\3.5.1.0__89845dcd8080cc91\System.Data.SqlServerCe.dll'.

Further reading helped me realize that Sync Framework did not support SqlServerCe v4.0, which make it incompatible with EntityFramework.

I am now wondering if the road I'm about to take is the right one. Any alternative solutions or workaround would be appreciated.

Some further informations that might be pertinent:

  • Number of clients ~100
  • Number of clients that will be allowed to sync both way (update central server) ~10
  • Database is quite small (20MB) with little growth expected.
Benoittr
  • 4,091
  • 4
  • 27
  • 38

1 Answers1

2

you can actually get it working with SQL CE 4, it's an unsupported one though.

see: SYNC FRAMEWORK AND SQL COMPACT 4 (YES, YOU CAN!)

JuneT
  • 7,840
  • 2
  • 15
  • 14
  • I've stumbled upon that link but I had some other exception when creating the connection afterward (I'll post the exact exception tomorrow). But I'm still wondering if that combination of framework will pass the test of time... – Benoittr Oct 10 '13 at 02:23
  • it's unsupported and we dont know what theyll change on SQL CE next. but never had issues with the workaround. If its not too late for you, you might want to consider using SQL Express or LocalDB on the client side or even SQLite using the Sync Fx Toolkit – JuneT Oct 10 '13 at 02:44