Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
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
Medium Priority
?
644 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 1600 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 200 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 200 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

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…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…

596 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