By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,496 Members | 1,527 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,496 IT Pros & Developers. It's quick & easy.

creating DAL, how????

P: n/a
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
Share this Question
Share on Google+
13 Replies


P: n/a
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

P: n/a
"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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
"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

P: n/a
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

P: n/a
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

P: n/a
"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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.