I would like to get the properties of my Parent object, but would not like to get the property (States) from my Country class. I tried the way it is in the "Test" class and I could not because I did not know the Type that is the IEnumerable.
I would have some other way of not only bringing this property to a generic condition, because I can not put the name of the property, because this is a process that will be used for all my entity classes, and I need to ignore all properties that are of type IEnumerable.
public partial class Teste
{
Pais pais = new Pais();
PropertyInfo[] properties = pais .GetType().GetProperties().Select(x =>
x.PropertyType != typeof(IEnumerable<T>));
}
public partial class Pais : EntityBase
{
public Pais() : base()
{
this.Estados = new HashSet<Estado>();
}
public override string TableName { get { return "PAIS"; } }
public override int Handle { get; set; }
public string Nome { get; set; }
public string Sigla { get; set; }
public virtual ICollection<Estado> Estados { get; set; }
public override DateTime DataCadastro { get; set; }
public override string UsuarioCadastro { get; set; }
public override DateTime? DataAlteracao { get; set; }
public override string UsuarioAlteracao { get; set; }
}