在数据访问层和业务层之间发送/接收业务对象是否可取? [英] Is it adviceable to send/ receive business objects between data access layer and business layer?

查看:80
本文介绍了在数据访问层和业务层之间发送/接收业务对象是否可取?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

向/从数据访问层发送业务对象是最佳选择吗?或者从dataaccess层接收数据表中的行。哪个是最好的办法?为什么?请帮我理解。谢谢



我的尝试:



不知道哪个是对的,我对此感到困惑。

Is sending business objects to/from data access layer the best option? Or receiving rows from datatable from the dataaccess layer. Which is the best thing to do? And why? Please help me get the understanding. Thanks

What I have tried:

Don’t know which is right and I’m confused with that.

推荐答案

你可以从DAL返回BO的类型。

下面用DAL编写的代码片段:



public SampleClassBO GetPrice(){

//创建对象for SampleClassBO

//从DB获取价格的一些数据库查询执行

//返回SampleClassBO对象

}
You can return type of BO from DAL.
Below snippet to be written in DAL:

public SampleClassBO GetPrice(){
//Create object for SampleClassBO
//Some db query execution to get the price from DB
//Set SampleClassBO properties
//Return SampleClassBO object
}


这篇关于在数据访问层和业务层之间发送/接收业务对象是否可取?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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