Asp.Net和C#中的三层体系结构 [英] Three tier architecture in Asp.Net and C#

查看:76
本文介绍了Asp.Net和C#中的三层体系结构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我正在尝试在asp.net应用程序中开发三层体系结构

我想创建一种结构,在该结构中,我将仅从数据访问层返回对象,而没有数据集,没有读取器,因此,如果以后更改数据库,它将不会影响其他层.

我正在遵循的建筑类型

1)表示层
2)业务访问层
3)数据访问层

现在,我将在BAL中具有用户信息类,而表示层将具有BAL的引用,我将填充该对象并将其发送给BAL Now

我希望将此对象发送到DAL,而DAL应该返回userinfo对象

注意:我不想在函数中传递任何参数.

您能为下面我已经尝试过的事情提出解决方案吗?

1)在DAL中创建与BAL中相同的类,同时传递值将导致无法从BAL对象转换为DAL对象的错误

2)我也尝试使用对象类

问候,
Amit Patele

Hi All,

I am trying to develop the three tier architecture in asp.net application

i want to create the structure where i will be returning object only from the Data Access layer no data set , no reader so that if i change data base later it wont effect other layers.

the kind of architecture i am following

1) Presentation Layer
2) Business access layer
3) Data Access layer

Now i will have user info class in BAL and presentation layer will have the reference of BAL i will fill this object and send it to BAL Now

i want this object to sent to DAL and DAL should return the userinfo object

Note : i don''t want to pass any parameter in function.

can you suggest a solution the below thing i already tried

1) create same class in DAL which is there in BAL while passing value it will give error not able convert from BAL object to DAL object

2) i also tried to use object class also

Regards,
Amit Patele

推荐答案

您还必须创建"Entity"类,并将它们传递到您的应用程序中.

如果您不想在方法中使用参数,则必须将它们放在传递的实体中.
You have to create "Entity" classes also and pass them around in your application.

If you aren''t going to use parameters in your methods then you will have to put them in the entities you pass around.




在全局类文件中声明该userinfo类.而该类存储在App_Code

然后,您可以在整个应用程序中使用该类对象.

最好的
Hi,

declare That userinfo class in global classes files.whereas stored in App_Code

Then you can use that class object in your entire application .

All the Best


这篇关于Asp.Net和C#中的三层体系结构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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