mercredi 13 juillet 2022

Get navigation property with Reflection in c#

Product Class

public class Product {
   public int Id { get; set; }
   //some properties

   //Navigation Property
   Category Category { get; set; }
}

Category Class

public class Category{
   public int Id { get; set; }
   //some properties

   //Navigation Property
   ICollection<Product> Products { get; set; }
}

i need to get navigation properties in product and category classes. It is enough to get ICollection and Category property name. So, i can exclude while i get columns in entities.

How can i get this properties with reflection?





Aucun commentaire:

Enregistrer un commentaire