![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I hope someone can provide some insight here. I'm trying to determine the best method of retaining and passing around data that has been read from the database. One thought is to Inherit From DataRow and provide type-safe methods, another is to create a dummy class that has nothing but public variables. The problem I see with the first method is the overhead in carrying around a DataRow, the problem with the second method is that every time I pull data, I have to move it into the dummy class. Can someone intimate with the CLR internals provide some insight as to which method may be better and why? // Sample using DataRow // DataRows are passed between the Business Layer and the Data Layer public class MyCar { private DataRow _rowData; public String CarName { get { return _rowData["CarName"].ToString(); } } pubilc Int32 CarID { get { return Convert.ToInt32(_rowData["CarName"].ToString(); } } public MyCar(DataRow row) { _rowData = row; } } // Sample using a dummy class // MyCarData is passed between the Business Layer and the Data Layer, the Business // layer no longer needs to know what a DataRow is. class MyCarData { public String CarName = String.Empty; public Int32 CarID = Int32.MinValue; } public class MyCar { private MyCarData _data = new MyCarData(); class MyCar(DataRow row) { _data.CarName = row["CarName"].ToString(); _data.CarID = Convert.ToInt32(row["CarID"]); } } |
#3
| |||
| |||
|
|
windows forms or webforms? |
#4
| |||
| |||
|
|
WinForms. But what would that have to do with it? these different architectures have different ways of storing global |
|
WinForms. But what would that have to do with it? "Alvin Bruney [MVP]" <vapor at steaming post office> wrote in message news:%23pvi8VYtEHA.2804 (AT) TK2MSFTNGP14 (DOT) phx.gbl... windows forms or webforms? |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |