创建DAL,怎么???? [英] creating DAL, how????

查看:72
本文介绍了创建DAL,怎么????的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




ASP.NET 2.0

我正在设计我的Web应用程序的DAL(数据访问层)。我希望

每个表都有一个强类型对象作为表格的包装器。所以

例如,如果DAL在表中找到3条记录,那么它会向BLL(业务逻辑层)发送一个包含3个对象的

泛型集合。


但问题是:

如果我需要做这样的选择(组合来自多个

表的数据)怎么办?: br />
从table_1选择field_1,field_2,field_3,table_2


此选择,因为某些字段来自不同的表。我应该为这个选择创建一个新的强类型对象吗?或者我可以使用上面提到的

包装器对象,或者你有什么建议????


Jeff

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

推荐答案

3月2日,9:40 pm,Jeff < it_consulta ... @ hotmail.com.NOSPAMwrote:
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



是的,


也许你可以在 http://msdn2.microsoft阅读本教程.com / zh-CN / library / aa581778.aspx


我觉得它真的很有用


这个也很好
http://msdn2.microsoft .com / zh-CN / library / ms978510.aspx


" Jeff" < it ************ @ hotmail.com.NOSPAMwrote in message

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

我正在设计我的Web应用程序的DAL(数据访问层)。我希望

每个表都有一个强类型对象作为表格的包装器。

因此,例如,如果DAL在表中找到3条记录,那么它发送

a BLL(业务逻辑层)的3个对象的通用集合。


但问题是:

如果需要,该怎么办?做这样的选择(组合来自多个

表的数据):

从table_1选择field_1,field_2,field_3,table_2


据我所知,我不能像上面提到的那样使用表包装器

这个选择,因为有些字段来自不同的表。

应该我只为这个选择创建一个新的强类型对象,或者可以

我使用上面提到的包装器对象,或者你有什么建议?
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????



你已经敲了敲头......


意见因此而异,但它''我认为DAL应尽可能轻,并且不应在任何情况下参考个别数据库或表格。如果你这样做,每次你修改你的架构,

你需要修改你的DAL!我的DAL非常依赖于

Microsoft DAAB,这样就意味着它可以被绝对地放入任何VS.NET

项目(WinForms或WebForms)中没有任何修改。


从你的描述中听起来好像你的DAL更像是一个混合/业务层和数据抽象层的组合 - 我强烈要求你重新考虑这个...

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...


谢谢你关于微软DAAB的重要提示,我没有'''知道了。

我用谷歌搜索了一些文章,我会读到这个主题。

如果你有关于DAAL的任何好的链接,也许你可以在这里张贴其中一些



" Mark Rae" < ma ** @ markNOSPAMrae.com写信息

新闻:%2 **************** @ TK2MSFTNGP06.phx.gbl ...
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 ...
"Jeff" <it************@hotmail.com.NOSPAMwrote in message
news:uP*************@TK2MSFTNGP06.phx.gbl...

>我正在设计我的网络应用程序的DAL(数据访问层)。我希望
每个表都有一个强类型对象作为表格的包装。
因此,例如,如果DAL在表中找到3条记录,那么它会发送一个由3个对象组成的通用集合到BLL(业务逻辑层)。

但问题是:
如果我需要做这样的选择(组合来自多个表的数据)怎么办:
从table_1选择field_1,field_2,field_3,table_2

据我所知,我不能只使用上面提到的表包装器
这个选择,因为有些字段来自不同的表格。
我应该为这个选择创建一个新的强类型对象,还是可以使用我上面提到的包装器对象,或者你有什么建议?
>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????



你已经敲了敲头......


意见因此而异,但它'''我认为DAL应该尽可能轻,并且在任何情况下都不应该参考个人数据库或表格。如果你这样做,每次你修改你的架构,

你需要修改你的DAL!我的DAL非常依赖于

Microsoft DAAB,这样就意味着它可以被绝对地放入任何VS.NET

项目(WinForms或WebForms)中没有任何修改。


从你的描述中听起来好像你的DAL更像是一个混合/业务层和数据抽象层的组合 - 我会

强烈建议你重新考虑这个...


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...



这篇关于创建DAL,怎么????的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆