I need your advice. I am trying to develop a 3 layer architecture in ASP.NET that separates BBL,DAL,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.
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;
}
listing data
BOboj_view {
private int _PId;
private string _Name;
private string _ClassName;
}
What's the best solution ,
thank you .
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.
You don't have to create another BO for listing and adding data. You can use the same BO object for both purposes.
Ref: 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();
来源:https://stackoverflow.com/questions/16936761/bll-dal-bo-inserting-data