473,416 Members | 1,570 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,416 software developers and data experts.

Looking for a decent data access architecture to implement

I am looking for a good solution on how to implement data access in an
application so that there is a clean separation between the data access
layer, the business layer and the GUI layer. I am looking for a robust
solution for a major application. Almost every developer seems to come
up with a completely different solution. While many of them are not
bad, I really want a very good one.

My database is SQL Server 2000 and I am using Visual Studio .NET for
application development. In the past I use to have a "data access
layer" that I wrote in code to insulate my business logic layer from
the actual database. The idea behind this was to make the app
independent of the actual database since it may have been necessary to
support different databases.

That was several years ago.

The problem I found with having a data access layer was that you had to
create classes and methods that abstract the data so that it isn't
database specific. This resulted in a lot of code creating recordsets
and migrating the data from the business layer to the data access
layer. Another problem with this approach is that every time you need
to make a change to the database model you need to change the code in
the data access layer and even the business layer (in the case of
adding a new field to a table or deleting one). This becomes tedious.
Furthermore, it was not possible to have data bound controls in the
GUI. Any changes to data in a textbox or grid had to be manually
changed in code to the underlying recordset before updating the
database.

The optimal solution that I was looking for was what ADO.NET appears to
offer. By using DataSets and XML, it is possible to abstract the actual
data source. In other words, the DataSet is independent of the actual
database or data source. But I am still left with a few issues that
seem awkward to handle.

First is using a DataSet with a control so that it is data bound. If I
bind a control to a DataSet, how is it possible to have some sort of
intermediate checking when data is added, modified or deleted? Is there
some event that can be trapped prior to an update so that I can inspect
the data, possibly modify it if necessary or even cancel the update?
How does this event fit into a business logic layer? Are these events
specific to DataSets or the control? From what I've seen, they seem to
short-circuit the business layer, i.e., changes in the GUI go straight
to the DataSet. Should these data change events be considered a data
access layer? If they are considered a data access layer, I would
assume that the proper programming technique would be to contain these
notification events in a class of their own separate from the GUI or
business layer. If you've done this before, how have you implemented
this separation.

Another issue has to do with maintaining the database model. I use to
use Visio Enterprise Architect that supports database modelling but I
came to the conclusion after lengthy use that this tool is ill-suited
for doing database modelling and maintenance. It really is a band-aid.
A better tool might be Rational Rose but currently I can't afford that.
What I have noticed is that in Visual Studio .NET you can use Sever
Explorer to open a database and create a diagram, which also can be
done using SQL Server Enterprise Manager. What I like about using
Visual Studio .NET for maintaining the database is the tight
integration with the other tools used to create DataSets. But it isn't
clear to me how to synchronize changes in the database to the various
elements in my app that use the database. In other words, if I add a
field, do I need to do a refresh somewhere to cause any currently
existing DataSets to reflect these changes?

Currently I haven't seen a decent solution on how to make a DataGrid
bind to a DataSet that allows me to get notifications prior to record
updates. Most of the samples I've seen posted all use code to add new
records.

I suppose what I am looking for is a solution that is cleanly separates
the data access layer from both the GUI and business logic layer and
where maintenance can be done as easily as possible using graphical
tools like those and assistants. Can you give me a few hints on the
architecture and/or method/processes you use for implementing data
access.

Any links to articles on this subject would be welcomed.

Thanks
Johann Blake

Nov 17 '05 #1
1 2557
Hi,

http://msdn.microsoft.com/practices/

Will give you what you want.

cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Johann Blake" <jo*********@yahoo.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
I am looking for a good solution on how to implement data access in an
application so that there is a clean separation between the data access
layer, the business layer and the GUI layer. I am looking for a robust
solution for a major application. Almost every developer seems to come
up with a completely different solution. While many of them are not
bad, I really want a very good one.

My database is SQL Server 2000 and I am using Visual Studio .NET for
application development. In the past I use to have a "data access
layer" that I wrote in code to insulate my business logic layer from
the actual database. The idea behind this was to make the app
independent of the actual database since it may have been necessary to
support different databases.

That was several years ago.

The problem I found with having a data access layer was that you had to
create classes and methods that abstract the data so that it isn't
database specific. This resulted in a lot of code creating recordsets
and migrating the data from the business layer to the data access
layer. Another problem with this approach is that every time you need
to make a change to the database model you need to change the code in
the data access layer and even the business layer (in the case of
adding a new field to a table or deleting one). This becomes tedious.
Furthermore, it was not possible to have data bound controls in the
GUI. Any changes to data in a textbox or grid had to be manually
changed in code to the underlying recordset before updating the
database.

The optimal solution that I was looking for was what ADO.NET appears to
offer. By using DataSets and XML, it is possible to abstract the actual
data source. In other words, the DataSet is independent of the actual
database or data source. But I am still left with a few issues that
seem awkward to handle.

First is using a DataSet with a control so that it is data bound. If I
bind a control to a DataSet, how is it possible to have some sort of
intermediate checking when data is added, modified or deleted? Is there
some event that can be trapped prior to an update so that I can inspect
the data, possibly modify it if necessary or even cancel the update?
How does this event fit into a business logic layer? Are these events
specific to DataSets or the control? From what I've seen, they seem to
short-circuit the business layer, i.e., changes in the GUI go straight
to the DataSet. Should these data change events be considered a data
access layer? If they are considered a data access layer, I would
assume that the proper programming technique would be to contain these
notification events in a class of their own separate from the GUI or
business layer. If you've done this before, how have you implemented
this separation.

Another issue has to do with maintaining the database model. I use to
use Visio Enterprise Architect that supports database modelling but I
came to the conclusion after lengthy use that this tool is ill-suited
for doing database modelling and maintenance. It really is a band-aid.
A better tool might be Rational Rose but currently I can't afford that.
What I have noticed is that in Visual Studio .NET you can use Sever
Explorer to open a database and create a diagram, which also can be
done using SQL Server Enterprise Manager. What I like about using
Visual Studio .NET for maintaining the database is the tight
integration with the other tools used to create DataSets. But it isn't
clear to me how to synchronize changes in the database to the various
elements in my app that use the database. In other words, if I add a
field, do I need to do a refresh somewhere to cause any currently
existing DataSets to reflect these changes?

Currently I haven't seen a decent solution on how to make a DataGrid
bind to a DataSet that allows me to get notifications prior to record
updates. Most of the samples I've seen posted all use code to add new
records.

I suppose what I am looking for is a solution that is cleanly separates
the data access layer from both the GUI and business logic layer and
where maintenance can be done as easily as possible using graphical
tools like those and assistants. Can you give me a few hints on the
architecture and/or method/processes you use for implementing data
access.

Any links to articles on this subject would be welcomed.

Thanks
Johann Blake

Nov 17 '05 #2

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

Similar topics

6
by: Sebastian Kemi | last post by:
How should a write a class to a file? Would this example work: object *myobject = 0; tfile.write(reinterpret_cast<char *>(myobject), sizeof(*object)); / sebek
3
by: SpamProof | last post by:
I'm looking for an example of a detailed design that I can follow or get ideas from before programming in vb.net. Currently, I'm using this outline approach that describes my Project, Classes,...
5
by: Aya9877 | last post by:
Alright, I have no idea what level book I need. I have a basic/decent background in coding. I am advanced in query building. I have a decent understanding of Visual Basic and some VBA. My...
2
by: Pete Woodhead | last post by:
I'm a beginner when it comes to Access. I'm decent with Excel, as decent as self taught can be and I've done a small amount of HTML programing. I have had some personal tutoring in Access, which...
3
by: Simon Harvey | last post by:
Hi, In my application I get lots of different sorts of information from databases. As such, a lot of information is stored in DataSets and DataTable objects. Up until now, I have been passing...
10
by: Teis Draiby | last post by:
In an application manipulating streaming video and 3D stuff I want to implement mutithreading to ensure a decent UI response time. Since my application is very speed critical I want to use the...
5
by: Natan | last post by:
I want to create an n-tier app and I would like an advice of you that know more than me about this. I want my app to support multiple databases in the way that when a client wants to use Oracle...
5
by: Lyle Fairfield | last post by:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/callnetfrcom.asp The Joy of Interoperability Sometimes a revolution in programming forces you to abandon all...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
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...
0
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
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...

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.