I have found lots of information about using Entity Framework 6 with Sql CE 4 and on using Entity Framework 4 with both Sql CE 4 and 3.5, but using Entity Framework 6 with Sql CE 3.5 is a different matter. As far as I can tell, CE 3.5 ships with a provider for Entity Framework 4 in System.Data.SqlServerCe.Entity.dll. This provider uses an older version of the base classes and if I try to use it, I get the following exception:
System.InvalidOperationException: The 'Instance' member of the Entity Framework provider type 'System.Data.SqlServerCe.SqlCeProviderServices, System.Data.SqlServerCe.Entity, Version=18.104.22.168, Culture=neutral, PublicKeyToken=89845dcd8080cc91' did not return an object that inherits from 'System.Data.Entity.Core.Common.DbProviderServices'. Entity Framework providers must inherit from this class and the 'Instance' member must return the singleton instance of the provider. This may be because the provider does not support Entity Framework 6 or later; see http://go.microsoft.com/fwlink/?LinkId=260882 for more information.
This makes sense and points me to the realization that what I need is a provider for Entity Framework 6 for Sql Server CE 3.5 SP2. I can't seem to find such a thing though. The nuget package EntityFramework.SqlServerCompact seems to only reference Sql Compact 4 in all its versions. Does such a provider already exist? If so, where can it be found? I seem to be having difficulty locating it. If not, would it be realistic to think of implementing it by using the code in the one for CE 4 with a reference to 3.5, or is the difference between CE 3.5 and 4 too different for that to be straightforward? Is there another workaround?
I need to use 3.5 because of a need for using merge replication, which is not supported in 4, and would like to use Entity Framework. If there's not a straightforward answer to this, I'll probably use something other than Entity Framework.
OK, this is the second request I hear for this, let us do it. I will fork the code, and make a Nuget package for 3.5 - how about "EntityFramework.SqlServerCompact.Legacy" ? The "only" code change required is the fact, that 3.5 does not support ORDER BY..FETCH..OFFSET syntax (ie paging) called via Take and Skip. Would you be interested in this?
UPDATE: Package now available on NuGet http://www.nuget.org/packages/EntityFramework.SqlServerCompact.Legacy