473,386 Members | 1,832 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,386 software developers and data experts.

creating DAL, how????

Hey

ASP.NET 2.0

I'm designing the DAL (Data Access Layer) of my web application. I want
every table to have a strongly typed object as wrapper arround the table. So
that for example if the DAL found 3 records in the table then it sends a
generic collection of 3 objects to the BLL (Business Logic Layer).

But here is the problem:
What if I need to do a select like this (combining data from multiple
tables):
select field_1, field_2, field_3 from table_1, table_2

As far as I know I cannot just use the table wrapper as I mentioned above on
this select, because some of the fields are from a different table. Should I
just create a new strongly typed object for this select or could I use the
wrapper objects I mentioned above, or what do you suggest????

Jeff
Mar 2 '07 #1
13 2040
On Mar 2, 9:40 pm, "Jeff" <it_consulta...@hotmail.com.NOSPAMwrote:
this select, because some of the fields are from a different table. Should I
just create a new strongly typed object for this select
yes,

maybe you can read this tutorial at http://msdn2.microsoft.com/en-us/library/aa581778.aspx

I think it's really useful

This one is good too
http://msdn2.microsoft.com/en-us/library/ms978510.aspx
Mar 2 '07 #2
"Jeff" <it************@hotmail.com.NOSPAMwrote in message
news:uP*************@TK2MSFTNGP06.phx.gbl...
I'm designing the DAL (Data Access Layer) of my web application. I want
every table to have a strongly typed object as wrapper arround the table.
So that for example if the DAL found 3 records in the table then it sends
a generic collection of 3 objects to the BLL (Business Logic Layer).

But here is the problem:
What if I need to do a select like this (combining data from multiple
tables):
select field_1, field_2, field_3 from table_1, table_2

As far as I know I cannot just use the table wrapper as I mentioned above
on this select, because some of the fields are from a different table.
Should I just create a new strongly typed object for this select or could
I use the wrapper objects I mentioned above, or what do you suggest????
You've hit the nail on the head...

Opinions vary on this, but it's my opinion that a DAL should be as light as
possible and should UNDER NO CIRCUMSTANCES make reference to individual
databases or tables. If you do this, every time you modify your schema,
you'll need to modify your DAL! My DAL is based very closely on the
Microsoft DAAB and, being so, means that it can be dropped into any VS.NET
project (WinForms or WebForms) with absolutely no modification whatever.

From your description it sounds very much as though your DAL is more of a
mixture / combination of business layer and data abstraction layer - I'd
strongly urge you to rethink this...
Mar 2 '07 #3
Thank you for that great tip about Microsoft DAAB, I didn't know about it.
I've googled and came across some articles which I will read of the subject.
If you have any great links about DAAL, maybe you could post some of them
here?
"Mark Rae" <ma**@markNOSPAMrae.comwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
"Jeff" <it************@hotmail.com.NOSPAMwrote in message
news:uP*************@TK2MSFTNGP06.phx.gbl...
>I'm designing the DAL (Data Access Layer) of my web application. I want
every table to have a strongly typed object as wrapper arround the table.
So that for example if the DAL found 3 records in the table then it sends
a generic collection of 3 objects to the BLL (Business Logic Layer).

But here is the problem:
What if I need to do a select like this (combining data from multiple
tables):
select field_1, field_2, field_3 from table_1, table_2

As far as I know I cannot just use the table wrapper as I mentioned above
on this select, because some of the fields are from a different table.
Should I just create a new strongly typed object for this select or could
I use the wrapper objects I mentioned above, or what do you suggest????

You've hit the nail on the head...

Opinions vary on this, but it's my opinion that a DAL should be as light
as possible and should UNDER NO CIRCUMSTANCES make reference to individual
databases or tables. If you do this, every time you modify your schema,
you'll need to modify your DAL! My DAL is based very closely on the
Microsoft DAAB and, being so, means that it can be dropped into any VS.NET
project (WinForms or WebForms) with absolutely no modification whatever.

From your description it sounds very much as though your DAL is more of a
mixture / combination of business layer and data abstraction layer - I'd
strongly urge you to rethink this...

Mar 2 '07 #4
If you want to do the kind of ORM classes that you refer to, you'll need to
use one of the frameworks that generates "wrapper" classes that provide for
things like programmatic Joins. I know there are some CodeSmith templates
that can generate this type of code, but frankly, unless you really know what
you are doing the learning curve to get there could be pretty steep.
Peter

--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net


"Jeff" wrote:
Hey

ASP.NET 2.0

I'm designing the DAL (Data Access Layer) of my web application. I want
every table to have a strongly typed object as wrapper arround the table. So
that for example if the DAL found 3 records in the table then it sends a
generic collection of 3 objects to the BLL (Business Logic Layer).

But here is the problem:
What if I need to do a select like this (combining data from multiple
tables):
select field_1, field_2, field_3 from table_1, table_2

As far as I know I cannot just use the table wrapper as I mentioned above on
this select, because some of the fields are from a different table. Should I
just create a new strongly typed object for this select or could I use the
wrapper objects I mentioned above, or what do you suggest????

Jeff
Mar 2 '07 #5
On Mar 2, 10:45 pm, "Mark Rae" <m...@markNOSPAMrae.comwrote:
"Jeff" <it_consulta...@hotmail.com.NOSPAMwrote in message

news:uP*************@TK2MSFTNGP06.phx.gbl...
I'm designing the DAL (Data Access Layer) of my web application. I want
every table to have a strongly typed object as wrapper arround the table.
So that for example if the DAL found 3 records in the table then it sends
a generic collection of 3 objects to the BLL (Business Logic Layer).
But here is the problem:
What if I need to do a select like this (combining data from multiple
tables):
select field_1, field_2, field_3 from table_1, table_2
As far as I know I cannot just use the table wrapper as I mentioned above
on this select, because some of the fields are from a different table.
Should I just create a new strongly typed object for this select or could
I use the wrapper objects I mentioned above, or what do you suggest????

You've hit the nail on the head...

Opinions vary on this, but it's my opinion that a DAL should be as light as
possible and should UNDER NO CIRCUMSTANCES make reference to individual
databases or tables. If you do this, every time you modify your schema,
you'll need to modify your DAL! My DAL is based very closely on the
Microsoft DAAB and, being so, means that it can be dropped into any VS.NET
project (WinForms or WebForms) with absolutely no modification whatever.

From your description it sounds very much as though your DAL is more of a
mixture / combination of business layer and data abstraction layer - I'd
strongly urge you to rethink this...
A DAL can be based on the DAAB, but a DAL is not the DAAB

Of course, if you don't have the separated machines or multiple DBs it
make no sense to make an application complicated by DAL...

Mar 2 '07 #6
"Alexey Smirnov" <al************@gmail.comwrote in message
news:11********************@s48g2000cws.googlegrou ps.com...
Of course, if you don't have the separated machines or multiple DBs it
make no sense to make an application complicated by DAL...
Indeed! An application should be simplified, not complicated, by a DAL...
Mar 3 '07 #7
Yeah, DAL is not the DAAB... I thought it was the same, but that was before
I had read some of the articles I came across on internet about DAAB
"Alexey Smirnov" <al************@gmail.comwrote in message
news:11********************@s48g2000cws.googlegrou ps.com...
On Mar 2, 10:45 pm, "Mark Rae" <m...@markNOSPAMrae.comwrote:
>"Jeff" <it_consulta...@hotmail.com.NOSPAMwrote in message

news:uP*************@TK2MSFTNGP06.phx.gbl...
I'm designing the DAL (Data Access Layer) of my web application. I want
every table to have a strongly typed object as wrapper arround the
table.
So that for example if the DAL found 3 records in the table then it
sends
a generic collection of 3 objects to the BLL (Business Logic Layer).
But here is the problem:
What if I need to do a select like this (combining data from multiple
tables):
select field_1, field_2, field_3 from table_1, table_2
As far as I know I cannot just use the table wrapper as I mentioned
above
on this select, because some of the fields are from a different table.
Should I just create a new strongly typed object for this select or
could
I use the wrapper objects I mentioned above, or what do you suggest????

You've hit the nail on the head...

Opinions vary on this, but it's my opinion that a DAL should be as light
as
possible and should UNDER NO CIRCUMSTANCES make reference to individual
databases or tables. If you do this, every time you modify your schema,
you'll need to modify your DAL! My DAL is based very closely on the
Microsoft DAAB and, being so, means that it can be dropped into any
VS.NET
project (WinForms or WebForms) with absolutely no modification whatever.

From your description it sounds very much as though your DAL is more of a
mixture / combination of business layer and data abstraction layer - I'd
strongly urge you to rethink this...

A DAL can be based on the DAAB, but a DAL is not the DAAB

Of course, if you don't have the separated machines or multiple DBs it
make no sense to make an application complicated by DAL...

Mar 3 '07 #8
ORM classes? -what is ORM acronym for?
"Peter Bromberg [C# MVP]" <pb*******@yahoo.yabbadabbadoo.comwrote in
message news:1D**********************************@microsof t.com...
If you want to do the kind of ORM classes that you refer to, you'll need
to
use one of the frameworks that generates "wrapper" classes that provide
for
things like programmatic Joins. I know there are some CodeSmith templates
that can generate this type of code, but frankly, unless you really know
what
you are doing the learning curve to get there could be pretty steep.
Peter

--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net


"Jeff" wrote:
>Hey

ASP.NET 2.0

I'm designing the DAL (Data Access Layer) of my web application. I want
every table to have a strongly typed object as wrapper arround the table.
So
that for example if the DAL found 3 records in the table then it sends a
generic collection of 3 objects to the BLL (Business Logic Layer).

But here is the problem:
What if I need to do a select like this (combining data from multiple
tables):
select field_1, field_2, field_3 from table_1, table_2

As far as I know I cannot just use the table wrapper as I mentioned above
on
this select, because some of the fields are from a different table.
Should I
just create a new strongly typed object for this select or could I use
the
wrapper objects I mentioned above, or what do you suggest????

Jeff

Mar 3 '07 #9
"Jeff" <it************@hotmail.com.NOSPAMwrote in message
news:u9**************@TK2MSFTNGP03.phx.gbl...
Yeah, DAL is not the DAAB... I thought it was the same, but that was
before I had read some of the articles I came across on internet about
DAAB
Sounds like you're heading in the right direction... :-)
Mar 3 '07 #10
Good point.

The website I'm developing (it's a hobby project) is using a database which
have the database on the same computer and the database is the standard SQL
Express which is installed by VS2005.....

One reason for using DAL/BLL is that I'm not sure about what database site
will be hosted on (maybe the hoster has mysql, maybe it is mssql 200...)...
Though I haven't decided on which hoster to use... I just thought it could
be a good idea to let the site be configurationable...

I'm not sure I need to use DAL/BLL but are doing it for developing my skills
in DAL/BLL design.. get my hands dirty in working with DAL/BLL could be good
for me... just in case I some day comes on a development project and need to
use my DAL/BLL skills
"Mark Rae" <ma**@markNOSPAMrae.comwrote in message
news:e6**************@TK2MSFTNGP06.phx.gbl...
"Alexey Smirnov" <al************@gmail.comwrote in message
news:11********************@s48g2000cws.googlegrou ps.com...
>Of course, if you don't have the separated machines or multiple DBs it
make no sense to make an application complicated by DAL...

Indeed! An application should be simplified, not complicated, by a DAL...

Mar 3 '07 #11
I agree. You can create a Data Access Layer that uses, for example, the v2
SqlHelper DAAB class to "talk to the database" - but the SqlHelper class IS
NOT THE "DAL".
Peter
--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net


"Alexey Smirnov" wrote:
On Mar 2, 10:45 pm, "Mark Rae" <m...@markNOSPAMrae.comwrote:
"Jeff" <it_consulta...@hotmail.com.NOSPAMwrote in message

news:uP*************@TK2MSFTNGP06.phx.gbl...
I'm designing the DAL (Data Access Layer) of my web application. I want
every table to have a strongly typed object as wrapper arround the table.
So that for example if the DAL found 3 records in the table then it sends
a generic collection of 3 objects to the BLL (Business Logic Layer).
But here is the problem:
What if I need to do a select like this (combining data from multiple
tables):
select field_1, field_2, field_3 from table_1, table_2
As far as I know I cannot just use the table wrapper as I mentioned above
on this select, because some of the fields are from a different table.
Should I just create a new strongly typed object for this select or could
I use the wrapper objects I mentioned above, or what do you suggest????
You've hit the nail on the head...

Opinions vary on this, but it's my opinion that a DAL should be as light as
possible and should UNDER NO CIRCUMSTANCES make reference to individual
databases or tables. If you do this, every time you modify your schema,
you'll need to modify your DAL! My DAL is based very closely on the
Microsoft DAAB and, being so, means that it can be dropped into any VS.NET
project (WinForms or WebForms) with absolutely no modification whatever.

From your description it sounds very much as though your DAL is more of a
mixture / combination of business layer and data abstraction layer - I'd
strongly urge you to rethink this...

A DAL can be based on the DAAB, but a DAL is not the DAAB

Of course, if you don't have the separated machines or multiple DBs it
make no sense to make an application complicated by DAL...

Mar 3 '07 #12
xke
Hi Jeff,

As a best practice I think it's good take a look at myGeneration /
doodads, also they have some few other dal architectures you can look
at.
On Mar 2, 3:40 pm, "Jeff" <it_consulta...@hotmail.com.NOSPAMwrote:
Hey

ASP.NET 2.0

I'm designing the DAL (Data Access Layer) of my web application. I want
every table to have a strongly typed object as wrapper arround the table. So
that for example if the DAL found 3 records in the table then it sends a
generic collection of 3 objects to the BLL (Business Logic Layer).

But here is the problem:
What if I need to do a select like this (combining data from multiple
tables):
select field_1, field_2, field_3 from table_1, table_2

As far as I know I cannot just use the table wrapper as I mentioned above on
this select, because some of the fields are from a different table. Should I
just create a new strongly typed object for this select or could I use the
wrapper objects I mentioned above, or what do you suggest????

Jeff

Mar 3 '07 #13
here's an alternative which provides a datasource in the same page so the sql code is visible with the table code...

http://msconline.maconstate.edu/tuto...pnet08-02.aspx

"Jeff" <it************@hotmail.com.NOSPAMwrote in message news:uP*************@TK2MSFTNGP06.phx.gbl...
Hey

ASP.NET 2.0

I'm designing the DAL (Data Access Layer) of my web application. I want every table to have a strongly typed object as wrapper
arround the table. So that for example if the DAL found 3 records in the table then it sends a generic collection of 3 objects to
the BLL (Business Logic Layer).

But here is the problem:
What if I need to do a select like this (combining data from multiple tables):
select field_1, field_2, field_3 from table_1, table_2

As far as I know I cannot just use the table wrapper as I mentioned above on this select, because some of the fields are from a
different table. Should I just create a new strongly typed object for this select or could I use the wrapper objects I mentioned
above, or what do you suggest????

Jeff

Mar 3 '07 #14

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

Similar topics

2
by: rdsteph | last post by:
Python411 is a series of podcasts about Python, aimed at hobbyists and others who are learning Python. Each episode focuses on one aspect of learning Python, or one kind of Python programming, and...
6
by: owen | last post by:
Generally speaking, what does it mean when I see a "button" with red text showing this message instead of the control I've dragged onto the web form in Design View.? (But the page works fine at...
2
by: Pawan | last post by:
Hi Guys, I have this current assignment where I have to develop online forms for local municipal authorities. I have to use adobe acrobat to create online forms from PDFs (which I have never done...
15
by: Carlos Lozano | last post by:
Hi, What is the right way to create an OCX COM component. The component is already registerred, but can't create an instance. I am using the reference to the interop module created. If I use...
2
by: LIN | last post by:
Hello, Greetings. I am creating a web site which will contain lot of articles. I had been planning to create simple HTML page on the server everytime i posted a article (eg. article12.html )....
2
by: Patrick | last post by:
I want to define a set of web-form templates in XML and render the equivalent web-form with ASP.NET, then process any input server controls on the form. Reading the XML file from Page_load is...
0
by: Ravi Ambros Wallau | last post by:
Hi: I've created a custom control - a grid that uses Infragistics to display some filters, the grid itself, and some buttons. Well, when using this control directly on WebForm, everything works...
12
by: Mats Lycken | last post by:
Hi, I'm creating a CMS that I would like to be plug-in based with different plugins handling different kinds of content. What I really want is to be able to load/unload plugins on the fly without...
15
by: David Thielen | last post by:
Hi; My ASP.NET app (C# calling J# under .net 2.0) creates a png file in a subdirectory to display as part of the created page. However, the bitmap will not display due to a security violation. ...
9
by: =?Utf-8?B?YmJn?= | last post by:
Hi all, I read somewhere "using kernel stuff in thread is not good.." if ManualResetEvent object is created in thread but not actually used, will it affect performance? Bob
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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,...

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.