If I have classes that are either entities or DTOs, so is nothing but properties, is there a way to loop through the properties of the class (not knowing directly what they are) and get or check the values and/or types of the properties.
These would be classes created by a code generated of a table which would create the class with properties for each field in the table.
For example:
I want to do something like:
loop through "login" to validate the data I may have gotten from a select of the database.
Thanks,
Tom
These would be classes created by a code generated of a table which would create the class with properties for each field in the table.
For example:
Code:
public class Entity
{
public IntType loginID = new IntType();
public IntType personID = new IntType();
public StringType userName = new StringType();
public StringType password = new StringType();
#region Properties
public object LoginID
{
get
{
object value = null;
return NullHandler.SetDbObjectValueFromValue(loginID, ref value);
}
set
{
NullHandler.GetValueFromDbObject(value, ref loginID);
}
}
public object PersonID
{
get
{
object value = null;
return NullHandler.SetDbObjectValueFromValue(personID, ref value);
}
set
{
NullHandler.GetValueFromDbObject(value, ref personID);
}
}
public object UserName
{
get
{
object value = null;
return NullHandler.SetDbObjectValueFromValue(userName, ref value);
}
set
{
NullHandler.GetValueFromDbObject(value, ref userName);
}
}
public object Password
{
get
{
object value = null;
return NullHandler.SetDbObjectValueFromValue(password, ref value);
}
set
{
NullHandler.GetValueFromDbObject(value, ref password);
}
}
#endregion
}
I want to do something like:
Code:
Entity login = new Entity();
loop through "login" to validate the data I may have gotten from a select of the database.
Thanks,
Tom