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 1 2585
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*********@ya hoo.com> wrote in message
news:11******** **************@ o13g2000cwo.goo glegroups.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 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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
|
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, Methods, properties etc and it goes something like this...
I. Project: ProjectName
A. Class: ClassName
1. New Method: MethodName
a. Method Description: Explain method purpose
|
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 problem is design structure. Where to begin, etc.
I see that everyone recommends The Access 97 Developer's Handbook (I
am looking for a Access 97 book), but is that going to be too advanced
in terms of getting a db off the ground? I am thinking I...
|
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
combined with reading I have been self teaching myself, but I'm
looking for lesson based tutorials. I've found numerous websites
which offer these, but I have no idea which are truly good.
I am learning Access because I hope to create some...
|
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 around chunks of data in
DataTables/DataSets, simply because that was the format that they were in
when the data was taken from the database. Now, I know this maybe a pretty
silly question with a standard "it depends" answer, but I'm going to...
| |
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 most efficient
synchronization of the shared data objects. What would that be in this case?
I think there's a very simple answer to this, but I am somewhat confused by
the different methods available.
The data I need to transfer between threads...
|
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 and not SQL server, I can easily port the
data layer without touching the rest of the code.
So, I have 2 ideas.
1: Take the way MS Pet Shop did (I read a LOT in many sites how this
|
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 that's
come before. To take an extreme example, suppose you have been writing
Visual Basic applications for years now. If you're like many
developers, you will have built up a substantial inventory of code in
that time. And if you've been following...
|
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...
|
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...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
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();...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |