EasyObjects.NET Programmers Reference

EasyObject.AddColumn Method 

After loading your BusinessEntity you can add custom columns, this is typically done to create a calculated column, however, it can be used to add a column just to hold state, it will not be saved to the database of course.

public DataColumn AddColumn(
   string name,
   Type dataType
);

Parameters

name
The name of the Column
dataType
Use Type.GetType() as in Type.GetType("System.String")

Return Value

The newly created DataColumn

Example

VB.NET

Dim emps As New Employees
If emps.LoadAll() Then

   Dim col As DataColumn = emps.AddColumn("FullName", Type.GetType("System.String"))
   col.Expression = Employees.ColumnNames.LastName + "+ ', ' + " + Employees.ColumnNames.FirstName

   Dim fullName As String

   Do
       fullName = CType(emps.GetColumn("FullName"), String)
   Loop Until Not emps.MoveNext
   

End If
C#
Employees emps = new Employees();
if(emps.LoadAll())
{
    DataColumn col = emps.AddColumn("FullName", Type.GetType("System.String"));
    col.Expression = Employees.ColumnNames.LastName + "+ ', ' + " + Employees.ColumnNames.FirstName;

    string fullName;

    do
        fullName = emps.GetColumn("FullName") as string;
    while(emps.MoveNext());
}

See Also

EasyObject Class | NCI.EasyObjects Namespace