I need to get all the properties of a class that is of type class. Ex:
public class Pessoa{
public virtual int? Id { get; set; }
public virtual MinhaClasse1 prop1{ get; set; }
public virtual MinhaClasse2 prop2{ get; set; }
}
I need to get the prop1
and prop2
properties. I tried to do something like this below but it did not work:
var propertiess = pessoa.GetProperties().Where(
prop => prop.PropertyType.BaseType == typeof(object));
Where person would be a generic entity (TEntity). For the purpose of assembling a ICriterion
for generic queries with relationship between classes.
foreach (PropertyInfo propriedade in listaPropriedadeClasse) {
var valorPropriedade = propriedade.GetValue(entity);
if (!valorPropriedade.IsNull()) {
criteria.Add(Property.ForName(propriedade.Name).Eq(valorPropriedade));
}
}