BLL, DAL, BO, data insertion

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

Inside DAL, I collect data through _view. I wonder if I should write another Boboj for each view? I already have a BOBOj class, but it does not contain all the fields.

When inserting data, I have to use my BOboj, however, when I list, should I create a BOBOj_view class or something else ??

Data Insertion (My Columbus contains only these 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 is the best solution

thanks.

+4
source share
1 answer

BLL talks with presentation level (ASP.Net pages) DAL negotiates with database (SQL, Oracle, etc.) BO - objects exchanged between BLL and DAL.

You do not need to create another BO to list and add data. You can use the same BO object for both purposes.

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

Put everything that you want to use for one object, for example:

 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(); 
+3
source

Source: https://habr.com/ru/post/1484602/


All Articles