My question is about 3 layer architecture.
My project is briefly something like the below, however what annoyed me is after I insert a new column inside my database, I have to update those all fields except for the BLL. In the presentation layer, I created an OBJ as well as inside the DAL plus inside the DAL, there is an SQL query. I have to update all those fields manually.
If I do it the 'normal' way, I put all those inside the presentation layer and update all in one place.
Am I applying this 3 layer architecture correctly and what are the advantages to using this layered architecture?
My second question is :
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 data,I am using views,in this case, should I create another BOboj_view class for every views or another something ??
what is the easyies way to do that?
for example;
I have 20 views and 40 class which mapped to every tables on sql server ,My views collect the data diffrent tables(that means different objects).should I creates 20 more class except of 40 which represent the view ?
OBJ
class BOboj {
private int _PId;
private string _Name;
.......
.......
}
DAL
BOboj_DAL {
public bool Add(BOboj obj)
{
using (SqlConnection con = Connect.connect)
{
string sql = "insert into Persons (Id,Name,
.......
.......
}
BBL
BOboj_BLL {
.......
.......
public bool Add(BOboj_DAL obj)
{
BOboj_DAL bb_dal = new BOboj_DAL();
try
{
return bb_dal.Ekle(obj);
}
catch (Exception)
{
throw;
}
finally { bb_dal = null; }
}
.......
.......
}
Presantaon Layer
protected void Add(object sender, DirectEventArgs e)
{
BOboj_BLL bll_= new BOboj_BLL ();
BOboj obj_ = new BOboj
{
Name = Name.Text,
..............
...............
};
bll_.Add(obj_ );
}
Thank you.
See Question&Answers more detail:
os