Search code examples
c#dependency-injectionrefactoringcompact-frameworkdata-access-layer

Sharing DAL between full and compact framework


I have WinCE app running running on the Compact Framework.

DAL is realized as IoC Services (still in Main EXE) using OpenNETCF.IOC library. This layer handles with POJO classes. Database access established with Compact Framework version of ADO.NET provider. This version is deprecated and not supported.

Now we should have second application that will run on Windows Desktop using the Full Framework. I wish to share a Data Access Layer between these two applications.

As I mentioned there are 2 ways:

  • Quick and dirty: share DAL C# source code between CF and FF. Both versions should use Some platform differences should be solved with conditional compilation directives
  • DAL code must be moved from CF app to new FF app (may be realized as WCF service). CF app now access database over client interface.

Which way is recommended?


Solution

  • Definitely go with #1.

    Since you're already abstracting things, why not abstract the DAL to use an ORM that is compatible with both the CF and the desktop and that allows you to swap out the data store implementation? If would avoid the pitfall that you fell into of being tied to a specific data store.