Question

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?

Was it helpful?

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.

OTHER TIPS

Since you are using Dependency Injection, it would be fairly easy to extract the platform differences from the DAL and hide them behind an abstraction. An platform-specific implementation of that abstraction can be injected into the DAL classes. This allows you to share the CAL C# code between CF and FF without needing to revert to conditional compilation directives. IMO this approach is not quick and dirty.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top