BLL,DAL,BO,插入数据 [英] BLL,DAL,BO,inserting data

查看:202
本文介绍了BLL,DAL,BO,插入数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要你的意见。我想开发一个ASP.NET 3层架构,分离BBL,DAL,BOboj。

I need your advice. I am trying to develop a 3 layer architecture in ASP.NET that separates BBL,DAL,BOboj.

在DAL里,我通过_view收集数据。我不知道,我应该写另一BOboj对每个视图??我已经有一个BOboj类,但它不包含所有字段。

Inside the DAL, I collect the data via _view. What I wonder, should I write another BOboj for every view??I have already has a BOboj class but it doesn't contain all fields.

当插入数据,我必须用我的BOboj,但何时上市,我应该创建BOboj_view类或其他东西??

When inserting data, I have to use my BOboj,however, when listing, should I create BOboj_view class or another something ??

在插入数据(我的柱只包含这些值)

inserting data (My colum only contains those values)

BOboj {
        private int _PId;
        private string _Name;
        private int _ClassId;

}

房源数据

BOboj_view {

        private int _PId;
        private string _Name;
        private string _ClassName;
}

什么是最好的解决办法,

What's the best solution ,

感谢您。

推荐答案

BLL会谈到presentation层(ASP.Net页)
DAL会谈,数据库(SQL,甲骨文等)
BO是BLL和DAL之间交换的对象。

BLL talks to the Presentation Layer (ASP.Net pages) DAL talks to the Database (SQL, Oracle, etc) BO are the objects exchanging between BLL and DAL.

您不必再创建一个BO上市和添加数据。您可以使用相同的BO对象有两种用途。

You don't have to create another BO for listing and adding data. You can use the same BO object for both purposes.

参考:
http://msdn.microsoft.com/en-us/library/aa581779.aspx

把一切你想要使用像下面的单个对象:

Put everything you want to use for the single object like the following:

BOboj {
        private int _PId;
        private string _Name;
        private int _ClassId;
        private string _ClassName;
}

SqlCommand cmd = new SqlCommand("SPName");

cmd.Parameters.AddWithValue("@PID", obj.PID);
cmd.Parameters.AddWithValue("@Name", obj.Name);
cmd.Parameters.AddWithValue("@ClassID", obj.ClassID);

cmd.ExecuteNonQuery();

这篇关于BLL,DAL,BO,插入数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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