本文介绍了创建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

推荐答案



是的,


也许你可以在


我觉得它真的很有用


这个也很好




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


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

你需要修改你的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,怎么????的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-15 13:20