Search code examples
c#.netcompact-frameworksql-server-ce

Designing data access for Compact Framework and Full Framework


We currently have a desktop app which uses data from SQL CE. We used Entity Framework for our ORM layer to the database and all data access methods are built around this.

Now we have to build a smaller scaled down "clone" of this app for Windows CE 6.0 on the Compact Framework, also using the same SQL CE database design as on the desktop version. The problem is that compact framework does not support Entity Framework, so we are forced to access the database the old fashioned way (ADO.net, datasets, etc). However this is causing duplication of our whole data access layer and maintenance on these two apps looks like it can turn into a nightmare.

Ideally I would like to switch to the lowest common denominator that will work for both platforms - with current information I guess that means using old ADO.net will be the way to go, compiled into a separate assembly, but I just wanted to ask if anybody here has any other suggestions, or have perhaps faced a similar situation? Are there any good alternatives to EF that could work on both compact and full framework?


Solution

  • We use the OpenNETCF ORM in Windows CE (backed with SQLCE), Desktop (backed with SQLCE) and Android (backed with SQLite) which uses nearly identical code for all three. I say "nearly" because the data store initialization code differs between them (target file name, where to store it, etc). You could pretty easily add a full SQL Server implementation as well - it's probably a near 1:1 copy of the SQLite stuff. I've never done it simply becasue I've not needed it.