Designing data access for Compact Framework and Full Framework

安稳与你 提交于 2019-12-07 10:42:30

问题


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?


回答1:


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.




回答2:


See Also: Is there any FREE ORM for .NET Compact Framework (Windows Mobile 6.1, SQLServerCE)?

Another Option: http://sqlite.phxsoftware.com/

Yet Another Option: http://www.db4o.com/s/compactframeworkdb.aspx



来源:https://stackoverflow.com/questions/11792978/designing-data-access-for-compact-framework-and-full-framework

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