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
615 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
5 Comments
 
LVL 16

Accepted Solution

by:
Vikram Singh Saini earned 400 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This video discusses moving either the default database or any database to a new volume.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

728 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now