473,806 Members | 2,879 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Database Layer With Different Types Database

I know this is a silly question, but I am looking for the best way.

I build a windows application with standard version and enterprise version.
Standard version use local SQL/Access as database. Enterprise version use
Centralized Web Service as Database. Which is the easiest way to handle this?
I have too many classes have data access.

I can create following classes, How could I use Interface or other ways to
call right DB?
class1
class1_db_sql
class1_db_acces s
class1_db_webse rvice
Oct 18 '06 #1
3 1654
Bit weird to use multiple db formats but anyway...

I'd make an interface class then inherit from that and override dependant on
which db.

so say interface was called MyInterface

public class dbAccess : MyInterface //inherit interface

public class dbEnterprise : MyInterface //inherit interface
then when u wanna use the access one:

MyInterface m = new dbAccess();

or the enterprise one

MyInterface m = new dbEnterprise();

And that ofcourse can neatly be used with the factory pattern.

then ur code for your method calls for both enterprise and access versions
will not change.
"Qingdong Z." <Qi*******@disc ussions.microso ft.comwrote in message
news:83******** *************** ***********@mic rosoft.com...
>I know this is a silly question, but I am looking for the best way.

I build a windows application with standard version and enterprise
version.
Standard version use local SQL/Access as database. Enterprise version use
Centralized Web Service as Database. Which is the easiest way to handle
this?
I have too many classes have data access.

I can create following classes, How could I use Interface or other ways to
call right DB?
class1
class1_db_sql
class1_db_acces s
class1_db_webse rvice

Oct 18 '06 #2
Go the the result of this search
http://groups.google.com/groups/sear...ccess+Layer%22

I answered the question more detailed there.


"Qingdong Z." <Qi*******@disc ussions.microso ft.comwrote in message
news:83******** *************** ***********@mic rosoft.com...
I know this is a silly question, but I am looking for the best way.

I build a windows application with standard version and enterprise
version.
Standard version use local SQL/Access as database. Enterprise version use
Centralized Web Service as Database. Which is the easiest way to handle
this?
I have too many classes have data access.

I can create following classes, How could I use Interface or other ways to
call right DB?
class1
class1_db_sql
class1_db_acces s
class1_db_webse rvice

Oct 19 '06 #3
Hi,

It sounds to me like you need a way of easily switching the data layer at compile-time, not runtime. In that case you can extend
Daniel's idea and add conditional compilation to choose the appropriate database at compile-time:

#define ENTERPRISE

using System;

static class DALFactory
{
static IDataAccessLaye r Create()
{
#if ENTERPRISE
return new EnterpriseDAL() ;
#else
return new StandardDAL();
#endif
}
}

If you're using VS.NET then it's even easier. Don't use the #define directive, but instead create a new configuration for your
solution in the Configuration Manager, and define the symbols there. When you want to build for the enterprise select the new
ENTERPRISE configuration that you created from the dropdown (instead of RELEASE or DEBUG). If you want a standard build, just
choose RELEASE.

HTH

--
Dave Sexton

"Qingdong Z." <Qi*******@disc ussions.microso ft.comwrote in message news:83******** *************** ***********@mic rosoft.com...
>I know this is a silly question, but I am looking for the best way.

I build a windows application with standard version and enterprise version.
Standard version use local SQL/Access as database. Enterprise version use
Centralized Web Service as Database. Which is the easiest way to handle this?
I have too many classes have data access.

I can create following classes, How could I use Interface or other ways to
call right DB?
class1
class1_db_sql
class1_db_acces s
class1_db_webse rvice

Oct 19 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

18
4628
by: mountain man | last post by:
Greetings to all database professionals and laymen, Let us make a bold assumption that we have developed a software tool for the SQL Server environment which simply acts as an interface between an end-user in an organization and the database, through the exclusive use of stored procedures which are authored by the organization or by software developers. All development work at the application software level may thereby be conducted...
4
2121
by: Luiz Geron | last post by:
Hi all, I'm testing the PDO wrapper to database modules and I'm wondering how few things like this there are around. My problem, actually, is the paramstyle of modules. I want to use kinterbasdb in the same code I use cx_oracle, for example, but paramstyle changes from one to other, than I searched for things like this and found nothing really usefull. The problem with PDO is that it was so dificult to find, since a few people seems to...
27
1976
by: Brett | last post by:
If I want to easily swap the database I'm using, what is the best method for developing that tier in my application? I'll have basically a 4 tier app: 1. presentation 2. business logic 3. data layer containing standard SQL compliant queries 4. any database I'm looking for the most efficient way to design tier 3. I can't use stored
3
1597
by: Alan | last post by:
I am coming from other programming tools field, and new to VB .NET. Just wondering what is the common approaching in database programming in VB .NET? 1) Are you guru always using the data aware controls to bound the database ? OR 2) Create separate data object/layer to access backend database and link to the front end ? ie. front <--> business <--> database <--> backend end object layer database
4
1571
by: Martyn Fewtrell | last post by:
Hi there I am just canvassing some opinions so feel free to add yours. I mainly work with VB.Net on dynamic websites driven by Access and have more recently been trying to introduce Business and Data layers. Most of my projects are fairly small so the justification for the extra work is marginal but it helps to clean up the projects and I can see the value. However this is my issue.
4
5133
by: ImOk | last post by:
I need to program generically. I am familiar with the ODBC layer but never used PDO or DB. Does anyone have any experience with these database layers? Thanks
2
1734
by: scott.alfon | last post by:
Hello, i need your help. I want to implement a php-script where I can access to different database types as PostSQL, MySQL etc. Is that possible? Furthermore I want to include an access authorization which defines the write- or read-access of each user. I hope this group could help me....I am looking for good ideas.
22
3529
by: amygdala | last post by:
Hi, I'm trying to grasp OOP to build an interface using class objects that lets me access database tables easily. You have probably seen this before, or maybe even built it yourself at some point in time. I have studied some examples I found on the internet, and am now trying to build my own from scratch. I have made a default table class (DB_Table), a default validation class (Validator) which is an object inside DB_Table and my...
8
4139
by: morleyc | last post by:
Hi, until recently i was quite happy to add data sources from mssql database in visual studio and drag the datasets directly onto the form this creating a directly editable form which worked well. However i have recently started a project which will require synchronization to a remote database. Also the underlying database provider may change at a later date. From what i have read it seems that a layered approach is necessary, or at...
0
9719
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10620
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10369
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10110
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9187
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6877
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5546
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4329
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3851
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.