Solved

Using the sane DAL (Data Access Layer) on a desktop and Windows Mobile System, with diferent databases clients

Posted on 2010-09-01
5
632 Views
Last Modified: 2012-05-10
Hi experts.

I'm developping an application that will run on both desktop and Windows Mobile platform. Since the application is the same, I'm developing it in a 3 tier project. The Data tier and the Business Tier will be the same on both applications. Only the presentation tier will be different.

My DAL was built in a way that we can connect to an Oracle Database (System.Data.OracleClient) when used by the Desktop app and to an SqlCE database, when using Windows Mobile.

The problem is that the DAL references both Oracle and SqlCE libraries when loaded and, to make it work on Desktop I need to install SqlCE, that will be never used in this way. Worse then this, when the DAL is loaded on a Windows mobile, they also needs to load OracleClient, that will never be available.

So, is there any way to load this references on runtime, without performance hits, and without loosing the connection pool that exists on OracleClient, or will I need to develop 2 DALs, one to each case described?

Thanks a lot.

0
Comment
Question by:regisdaniel
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 16

Accepted Solution

by:
Vikram Singh Saini earned 400 total points
ID: 33583550
Hi,

There are two things:

(1) No, you can  not add reference at runtime.  Adding  reference creates  several classes that provide you different methods and properties; those  classes need to be compiled before they can be used.
 
(2) But Yes, the same can be made possible by Reflection. You should have look on link:
http://www.codeguru.com/csharp/csharp/cs_syntax/reflection/article.php/c5881

Regards,
VSS
0
 
LVL 1

Assisted Solution

by:waheedk
waheedk earned 50 total points
ID: 33583840
you need to develop two different DALs each for a DBMS, and use a DAL factory for loading the required DAL.
0
 

Author Comment

by:regisdaniel
ID: 33585238
Hi VSS and Waheedk, thanks for your help.

VSS, do you know if the Connection Pool functionality will be preserved if I use reflection, as you suggest ?

Waheedk, the solution you provided, using a Database Factory, also uses Reflection to Load the correct DAL?

Thanks.
0
 
LVL 16

Expert Comment

by:Vikram Singh Saini
ID: 33585282
Hi,

As far I know about Connection Pooling it is the concept that is attached with website. For e.g., if your website which is been deployed on IIS server, then if your application is connecting to database, and you have made Connection Pooling to true, then in that case the asp worker process is there to maintain connection pooling, & it is preserved until any type of modifcations is not done in connectionString be it in ordering or in the data within it.

However after a specified period of time, if connections are not used from connection pool they are destroyed automatically. So I think there should be no issues while using reflection.

Regards,
VSS
0
 
LVL 6

Assisted Solution

by:PJBX
PJBX earned 50 total points
ID: 33592283
I think you should have separate DALs.  How much data do you plan on loading? I would be concerned about SQLCE and memory. However, if you have to, the Entity Framework 4 might be an option for both platforms.
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

695 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question